PyXB v1.2.5
Classes are generated without errors or warnings with
pyxbgen -u EnvioCFE_entreEmpresas.xsd -m myclass
The problem occurs when parsing a valid xml data file.
import myclass
with open("./xml/Sob_111111111111_20161207_99999.xml") as f:
xml_str = f.read()
xml_doc = myclass.CreateFromDocument(xml_str)
Traceback (most recent call last):
File "pi.py", line 6, in <module>
xml_doc = eceelib.CreateFromDocument(xml_str)
File "/home/pyefuy/devel/XSDs_FE_1_36/myclass.py", line 71, in CreateFromDocument
saxer.parse(io.BytesIO(xmld))
File "/usr/lib/python2.7/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python2.7/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python2.7/xml/sax/expatreader.py", line 210, in feed
self._parser.Parse(data, isFinal)
File "/usr/lib/python2.7/xml/sax/expatreader.py", line 351, in end_element_ns
self._cont_handler.endElementNS(pair, None)
File "/usr/local/lib/python2.7/dist-packages/pyxb/binding/saxer.py", line 388, in endElementNS
binding_object = this_state.endBindingElement()
File "/usr/local/lib/python2.7/dist-packages/pyxb/binding/saxer.py", line 226, in endBindingElement
self.__constructElement(self.__delayedConstructor, self.__attributes, args)
File "/usr/local/lib/python2.7/dist-packages/pyxb/binding/saxer.py", line 116, in __constructElement
self.__bindingInstance = new_object_factory(*content, **kw)
File "/usr/local/lib/python2.7/dist-packages/pyxb/binding/basis.py", line 1613, in __call__
args = [ self.compatibleValue(args[0], **kw) ]
File "/usr/local/lib/python2.7/dist-packages/pyxb/binding/basis.py", line 1635, in compatibleValue
raise pyxb.ElementChangeError(self, value)
pyxb.exceptions_.ElementChangeError:
Value 2 for element {http://cfe.dgi.gub.uy}TipoDocRecep incompatible with fixed content
What seems inappropriate is that the rejected as invalid value '2' is exactly the set value for the attribute "fixed" in type description on the schema. The same value in the parsed xml data file.
The "TipoDocRecep" type is defined in "CFEType.xsd" as follow
[here](http://bit.ly/2kTe5lP) in xml data file: ```2 ```
If I modify `CFEType.xsd` like this:
``` ```
then the xml file parse gently.
[Full XSD schema](http://bit.ly/2kiKAXo), xml data file and other details can be found [here](https://bitbucket.org/emezeta/pyefuy)
PyXB v1.2.5 Classes are generated without errors or warnings with
The problem occurs when parsing a valid xml data file.
What seems inappropriate is that the rejected as invalid value '2' is exactly the set value for the attribute "fixed" in type description on the schema. The same value in the parsed xml data file.
The "TipoDocRecep" type is defined in "CFEType.xsd" as follow