Component Model

PyXB’s component model is the representation of XML schema components as a complex relation of data objects. Each object class corresponds to one of the thirteen XML Schema Components, and names of components and their properties follow those definitions. All classes specific to the component model are found in the pyxb.xmlschema.structures module.

The relationships amongst components is depicted in the following diagram. Composite aggregation generally denotes ownership and shared aggregation reference, but don’t look for consistency.

_images/ComponentModel.jpg

Component Model Mix-ins

A variety of Mix-in classes are used to allow common code to be abstracted or to mark objects as having certain capabilities. These mixins are:

Other Information

Most of the important information about the component model is best obtained from the specification or from the PyXB component model API. Tidbits of other relevant information:

  • An understanding of Namespace Resolution is important.
  • Element and attribute declarations that are incorporated by reference are represented in local scope by a copy of the global declaration. This aids in the infrastructure that binds declarations from model and attribute groups to a specific context. Local declarations are associated only with the complex type in which they appear; types that extend or restrict that type refer to the declaration instance associated with the base type.
  • PyXB strictly enforces the requirement that multiple element declarations within a complex type be compatible with respect to type and other attributes. Since occurrence restrictions are associated with a Particle instance rather than the declaration, the same element can appear in multiple places with different multiplicities. Note, though, that the default code generation module collapses all occurrences of any given element into a single Python field in the binding.