Last week we had a trouble to generate an object model using pyxbgen to support the entire ECMA-376 3rd Edition (Office Open ML). Thanks to pabigot help, we were able to do it. Now, that we are testing it, trying to parse each xml file inside to a pptx fiel, we found a possible issue.
In one of the XSD files (dml-main.xsd) you'll find the following union:
If you see, the pattern validation correspond to just one of the elements (ST_TextBulletSizePercent). Is like the second element in the union (ST_TextBulletSizeDecimal) was not taken into account.
Does anyone have idea of what is happening here? Did anyone have a similar issue?
I'll appreciate your help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I made support for ecma-376 an enhancement for PyXB 1.2.1. What I think you're seeing is: The excerpt you provided is the binding for the simple type ST_TextBulletSizePercent, and is correct. There is a separate binding for the union type ST_TextBullet which will have a definition beginning with:
What I think you're seeing is a result of mixing the strict and transitional schema. In the strict schema, the union has only one member: ST_TextBulletSizePercent. In the transitional schema, the union has both members. The instructions I originally provided were for the strict schema.
The transitional schema can't be translated by PyBX 1.2.0; a diagnostic is generated suggesting a violation of an XSD constraint on "all" model groups. On first glance this appears to be a bug in PyXB. It may not be present in PyXB 1.1.5.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The bug can be avoided by modifying the transitional vml-officeDrawing.xsd at line73 to remove the 'minOccurs="0"' attribute. Since all members of the model group already have 'minOccurs="0"' this has no effect on the content. That the original does not pass is still a PyXB bug that will be fixed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Peter for your comments. Analyzing our situation, we discovered that pyxb 1.2.0 generated fine the object model. My problem was the I tried to parse each xml file contained into a pptx file generated with MS Office 2010. The object model we got was generated with the XSDs of the ECMA-376 3rd edition standard. An office 2010 doesn't support this standard. office 2013 support it. So now, we are generating the new model using the 1st edition of the ECMA standard.
Thanks!
Maxi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello all, me again.
Last week we had a trouble to generate an object model using pyxbgen to support the entire ECMA-376 3rd Edition (Office Open ML). Thanks to pabigot help, we were able to do it. Now, that we are testing it, trying to parse each xml file inside to a pptx fiel, we found a possible issue.
In one of the XSD files (dml-main.xsd) you'll find the following union:
<xsd:simpleType name="ST_TextBulletSize">
<xsd:union memberTypes="ST_TextBulletSizePercent ST_TextBulletSizeDecimal"/>
</xsd:simpleType>
<xsd:simpleType name="ST_TextBulletSizePercent">
<xsd:restriction base="xsd:string">
<xsd:pattern value="0*((2)|()|()|400)%"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ST_TextBulletSizeDecimal">
<xsd:restriction base="ST_PercentageDecimal">
<xsd:minInclusive value="25000"/>
<xsd:maxInclusive value="400000"/>
</xsd:restriction>
</xsd:simpleType>
Surfing for the objects generated by pyxbgen, we saw that this union or this validation was translated as follow:
class ST_TextBulletSizePercent (pyxb.binding.datatypes.string):
"""An atomic simple type."""
_ExpandedName = pyxb.namespace.ExpandedName(_Namespace_a, u'ST_TextBulletSizePercent')
_DefinitionLocation = pyxb.utils.utility.Location(u'../xsd//dml-main.xsd', 2738, 2)
_Documentation = None
ST_TextBulletSizePercent._CF_pattern = pyxb.binding.facets.CF_pattern()
ST_TextBulletSizePercent._CF_pattern.addPattern(pattern=u'0*((2)|()|()|400)%')
ST_TextBulletSizePercent._InitializeFacetMap(ST_TextBulletSizePercent._CF_pattern)
_Namespace_a.addCategoryObject('typeBinding', u'ST_TextBulletSizePercent', ST_TextBulletSizePercent)
If you see, the pattern validation correspond to just one of the elements (ST_TextBulletSizePercent). Is like the second element in the union (ST_TextBulletSizeDecimal) was not taken into account.
Does anyone have idea of what is happening here? Did anyone have a similar issue?
I'll appreciate your help.
I made support for ecma-376 an enhancement for PyXB 1.2.1. What I think you're seeing is: The excerpt you provided is the binding for the simple type ST_TextBulletSizePercent, and is correct. There is a separate binding for the union type ST_TextBullet which will have a definition beginning with:
That's where to look for anomalies.
What I think you're seeing is a result of mixing the strict and transitional schema. In the strict schema, the union has only one member: ST_TextBulletSizePercent. In the transitional schema, the union has both members. The instructions I originally provided were for the strict schema.
The transitional schema can't be translated by PyBX 1.2.0; a diagnostic is generated suggesting a violation of an XSD constraint on "all" model groups. On first glance this appears to be a bug in PyXB. It may not be present in PyXB 1.1.5.
The bug can be avoided by modifying the transitional vml-officeDrawing.xsd at line73 to remove the 'minOccurs="0"' attribute. Since all members of the model group already have 'minOccurs="0"' this has no effect on the content. That the original does not pass is still a PyXB bug that will be fixed.
Oh: When the bug is fixed, the generated code for the transitional ST_BulletSize includes both simple types as options within the union.
Thanks Peter for your comments. Analyzing our situation, we discovered that pyxb 1.2.0 generated fine the object model. My problem was the I tried to parse each xml file contained into a pptx file generated with MS Office 2010. The object model we got was generated with the XSDs of the ECMA-376 3rd edition standard. An office 2010 doesn't support this standard. office 2013 support it. So now, we are generating the new model using the 1st edition of the ECMA standard.
Thanks!
Maxi