Menu

#60 Flag to ignore xsi:type information in documents

PyXB 1.1.0
closed
None
fixed
Content model
trivial
PyXB 1.0.0
enhancement
2009-11-30
2009-11-24
No

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.

1 Attachments

Discussion

  • Peter A. Bigot

    Peter A. Bigot - 2009-11-24

    In pyxb.binding.basis.py around line 1430 is this comment:

    xsi:type should only be provided when using an abstract class,

    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?

     
  • Arne Grimstrup

    Arne Grimstrup - 2009-11-24

    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.

     
  • Peter A. Bigot

    Peter A. Bigot - 2009-11-29
    • status changed from new to closed
    • resolution set to fixed

    I believe this should work using the attached patch and setting XSI.ProcessTypeAttribute to PT_lax. Three modes are supported:

    • PT_strict: xsi:type is validated and supersedes the declared type. If no xsi:type is present, the declared element type will be used. If xsi:type is present, it must resolve to valid type. The resolved type must be a subclass of the declared type (if available), and will be used for the binding. This is the default mode.
    • PT_lax: xsi:type supersedes the declared type without validation. If no xsi:type is present, or it is present and fails to resolve to a type, the declared element type will be used. If xsi:type is present and resolves to valid type, that type will be used for the binding, even if it is not a subclass of the declared type."""
    • PT_skip: xsi:type attributes are ignored. The declared element type will be used.

    This change will not be integrated into 1.0.1, but will appear in 1.1.0.

     
  • Peter A. Bigot

    Peter A. Bigot - 2009-11-29

    Patch for #60

     
  • Arne Grimstrup

    Arne Grimstrup - 2009-11-30

    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.

     
  • Peter A. Bigot

    Peter A. Bigot - 2009-11-30

    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.

     
  • Arne Grimstrup

    Arne Grimstrup - 2009-11-30

    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.

     
MongoDB Logo MongoDB