#133 problem with pyxbgen when the xsd has a <xsd:choice> entry

PyXB 1.2.0
closed
None
fixed
Binding model
major
PyXB 1.1.3
defect
2012-11-01
2012-05-01
Bill Riegel
No

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

1 Attachments

Discussion

  • Bill Riegel

    Bill Riegel - 2012-05-01
     
  • Peter A. Bigot

    Peter A. Bigot - 2012-06-13
    • status changed from new to accepted
    • milestone changed from PyXB 1.1.4 to PyXB 1.1.5
     
  • Peter A. Bigot

    Peter A. Bigot - 2012-08-30
    • milestone changed from PyXB 1.1.5 to PyXB 1.2.0
     
  • Peter A. Bigot

    Peter A. Bigot - 2012-11-01
    • status changed from accepted to closed
    • resolution set to fixed

    Fixed at or before the following commit. NOTE: This is fixed only in the 1.2.x series.

    commit 94abd54d5a6dd7c43c1daa1f1b7c20c997528712
    Author: Peter A. Bigot <pab@pabigot.com>
    Date:   Thu Nov 1 12:22:32 2012 -0500
    
        trac/133: problem with pyxbgen when the xsd has a choice entry
    
        Validate that problem has been resolved with FAC-based content model.
    
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks