Flag to ignore xsi:type information in documents
Brought to you by:
pabigot
Castor, one of the Java equivalents of PyXB, inserts xsi:type information in documents it generates when it shouldn't. In order to use Castor-generated documents, it would be handy to have the option of disregarding xsi:type information.
In pyxb.binding.basis.py around line 1430 is this comment:
or a concrete class that happens to be the same, but in practice
web services tend to set it on nodes just to inform their
lax-processing clients how to interpret the value.
Is what Castor puts in wrong, or simply redundant? Is what it puts in correct as far as namespace (i.e., uses a QName that references a declared namespace), so the flag could be isolated to apply only to xsi:type attributes that identify types in specific namespaces? Would it work to mark certain types in your schema as being ones that are not overridden by an xsi:type attribute?
What we're seeing is that Castor is inserting the element's name if that element has a anonymous type. It should be putting in a complexType or simpleType name only according to the specification so, in this case, there should be no xsi:type information added.
For our purposes, telling the binding to ignore the xsi:type information if that information is not a complexType or simpleType would be sufficient.
I believe this should work using the attached patch and setting XSI.ProcessTypeAttribute to PT_lax. Three modes are supported:
This change will not be integrated into 1.0.1, but will appear in 1.1.0.
Patch for #60
I'm unable to get the attached patch to work because PyXB-1.0.0 does not have a file tests/trac/test-trac-0060.py, for which some diffs are provided. Also, are there other patches that need to be applied with this set? I add patch 57 and 58 and get some failures in pyxb/binding/basis.py and pyxb/binding/saxer.py portions of patch 60.
Yeah, I missed one change set that's in the middle. Managing the patches is a pain; rather than try to get one that works off 1.0.0, I propose to just bundle up 1.1.0 and that you start using that. This might take a day or so, since I have to update release notes and test on a variety of platforms.
I'd like to get out manually patching too, so I'll welcome 1.1.0 with open arms whenever you're ready to release it.