Limitations

Things That Work

  • Class constants corresponding to string enumeration constraints
  • Simple and complex type definitions
  • List and union datatypes
  • Constraints on (simple) datatypes (e.g., minInclusive, length)
  • Model groups and attribute groups
  • Complex content models (all, sequence, choice); minOccurs and maxOccurs
  • Abstract types, xsi:type, substitution groups
  • Nillable elements with xsi:nil
  • Namespace qualified attributes and elements
  • Documentation annotations present in the schema are converted to Python docstrings in the generated bindings.
  • Pattern constraints (as long as the simple type derives from something that is represented as a Python string)

Things That Don’t Work

...but could someday

  • The ability to use templates to customize binding generation was promised in the vision document. That has not yet been done, though it should be fairly straightforward.
  • Identity constraints (“key”, “unique”, “keyref”) are stored in the content model, but are not used.
  • Wildcard elements are supported in the sense that classes that enable them in the content model provide access to unrecognized values through the complexTypeDefinition.wildcardElements method. Where the type of the node is recognized, it is converted to a Python binding instance; otherwise, the xml DOM instance is stored. Neither the namespace constraint nor process contents attributes of the wildcard are applied.
  • Wildcard attributes are supported in the same sense as wildcard elements: no constraints are checked, and all are aggregated into the complexTypeDefinition.wildcardAttributeMap. Values are uninterpreted Unicode strings.

...and probably never will

  • When generating a DOM instance from a binding instance, the resulting document should validate against the schema, but the order of elements within it may be different from the original order of creation. For an example of this, see tests/test-mg-choice:TestMGChoice.testMultichoiceOrderImportant. See also complexTypeDefinition._validatedChildren for a work-around.
  • The redefine directive is not supported.

Things That Mostly Work, But They’re Ugly

  • The duration type is based on the Python datetime.timedelta class, which works reasonably well for small deltas but does not handle month and year deltas. The PyXB version records that information, but the timedelta functionality (adding/substracting from datetime instances) does not incorporate that portion of the delta. Negative durations also may not work properly.

Intended Near-Term Enhancements

  • Any requests?