The `DocumentFormat.OpenXml.Office2010.Drawing.TextMath` should not inherit OpenXmlLeafElement
Describe the bug
The DocumentFormat.OpenXml.Office2010.Drawing.TextMath (a14:m) is inherit OpenXmlLeafElement now. But as the document says, the DocumentFormat.OpenXml.Office2010.Drawing.TextMath (a14:m) will contain the OfficeMath element.
The sample OpenXML document:
<a:p>
<a:r>
<a:rPr lang="en-US" altLang="zh-CN" dirty="0" />
<a:t>123</a:t>
</a:r>
<a14:m>
<m:oMath xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">
<m:r>
<a:rPr lang="en-US" altLang="zh-CN" b="0" i="1" smtClean="0">
<a:latin typeface="Cambria Math" panose="02040503050406030204" pitchFamily="18" charset="0" />
</a:rPr>
<m:t>123</m:t>
</m:r>
</m:oMath>
</a14:m>
<a:endParaRPr lang="zh-CN" altLang="en-US" dirty="0" />
</a:p>
As the [MS-ODRAWXML]-181211 says:
2.3.3.41 CT_TextMath
Target namespace: http://schemas.microsoft.com/office/drawing/2010/main Referenced by: m This type contains either a math zone or document-level math properties. Math zone content can be either an inline math zone or a math paragraph. Child Elements: m:oMath: A CT_OMath ([ISO/IEC29500-1:2016] section 22.1.2.77) element that specifies an instance of mathematical text.
The following W3C XML Schema ([XMLSCHEMA1/2] section 2.1) fragment specifies the contents of this complex type. <xsd:complexType name="CT_TextMath"> xsd:sequence <xsd:element ref="m:oMath"/> </xsd:sequence> </xsd:complexType> See section 5.1 for the full W3C XML Schema ([XMLSCHEMA1/2] section 2.1).
And
<xsd:complexType name="CT_TextMath">
<xsd:sequence>
<xsd:element ref="m:oMath"/>
</xsd:sequence>
</xsd:complexType>
Screenshots If applicable, add screenshots to help explain your problem.
To Reproduce None.
Observed behavior
We can not get the ChildElements from DocumentFormat.OpenXml.Office2010.Drawing.TextMath. And it will cause some unexpected behavior, such as https://github.com/dotnet/Open-XML-SDK/issues/1033
Expected behavior
The DocumentFormat.OpenXml.Office2010.Drawing.TextMath should inherit OpenXmlCompositeElement type.
Desktop (please complete the following information):
- OS: [e.g. Windows]
- Office version [e.g. 16.0.15427.20178]
- .NET Target: (e.g. .NET Framework, .NET Core, UWP, Xamarin...)
- DocumentFormat.OpenXml Version: (e.g. 2.11.0)
Additional context Add any other context about the problem here.
Reference:
https://github.com/dotnet/Open-XML-SDK/blob/b1d49f34a5945a1faedb8f28f482e73cfd99126f/data/schemas/schemas_microsoft_com_office_drawing_2010_main.json#L779-L786
@lindexi I've created PR #1941 which fixes this. The change will be a breaking API change but you are welcome to grab the fix and use it as needed locally until v4.0.