I've modified the po.xsd and po.xml to include
a choice under the item entry
<xsd:choice>
<xsd:element name="USPrice" type="xsd:decimal" minOccurs="0"/>
<xsd:element ref="po:comment" minOccurs="0"/>
</xsd:choice>
if and when you have an item with only a USPrice and another item
with only a comment, you get the following error
pydev debugger: starting
Traceback (most recent call last):
File "C:\downloads\eclipse_indigo_3_7\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\pydevd.py", line 1307, in <module>
debugger.run(setupfile, None, None)
File "C:\downloads\eclipse_indigo_3_7\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\pydevd.py", line 1060, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "C:\Users\hbl4152\workspace\python1\src\pocSample.py", line 6, in <module>
pobObject = poc.CreateFromDocument(xml, location_base='poc.xml')
File "C:\Users\hbl4152\workspace\python1\src\poc.py", line 32, in CreateFromDocument
saxer.parse(StringIO.StringIO(xml_text))
File "C:\Python27\lib\xml\sax\expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "C:\Python27\lib\xml\sax\xmlreader.py", line 123, in parse
self.feed(buffer)
File "C:\Python27\lib\xml\sax\expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "C:\Python27\lib\xml\sax\expatreader.py", line 349, in end_element_ns
self._cont_handler.endElementNS(pair, None)
File "C:\Python27\lib\site-packages\pyxb\binding\saxer.py", line 374, in endElementNS
binding_object = this_state.endBindingElement()
File "C:\Python27\lib\site-packages\pyxb\binding\saxer.py", line 232, in endBindingElement
self.bindingInstance.validateBinding()
File "C:\Python27\lib\site-packages\pyxb\binding\basis.py", line 422, in validateBinding
self._validateBinding_vx()
File "C:\Python27\lib\site-packages\pyxb\binding\basis.py", line 1836, in _validateBinding_vx
raise pyxb.BindingValidationError('Error matching content to binding model: %s' % (e,))
pyxb.exceptions_.BindingValidationError: Error matching content to binding model: Ungenerated symbols: {<pyxb.binding.content.ElementUse object at 0x02D54E10>: [u'Want this for the holidays!']}
Poc.xsd is the modified xsd
Poc.xml is the example xml file
The error is seen when i run pocsample.py
Fixed at or before the following commit. NOTE: This is fixed only in the 1.2.x series.