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.
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:
- pyxb.xmlschema.structures._SchemaComponent_mixin marks the object
as being a schema component and holds its
pyxb.namespace.NamespaceContext. It also records relations between
components in a global definition and their clones where those definitions
are expanded.
- pyxb.xmlschema.structures._Singleton_mixin is used to ensure there is only one instance each
of the simple ur-type and ur-type. It overloads
__new__ to ensure that only one instance of the class is ever
constructed.
- pyxb.xmlschema.structures._Annotated_mixin provides the support for all components that
contain an annotation
as a child element.
- pyxb.xmlschema.structures._NamedComponent_mixin supports components
that can be identified by name. This includes the target namespace (which
may be anonymous) if the component is global, and the complex type
definition
that serves as the component’s scope when it is local.
- pyxb.xmlschema.structures._ValueConstraint_mixin provides support
for components that have value constraints : that is,
provide a default value and optionally require a fixed value.
- pyxb.xmlschema.structures._ScopedDeclaration_mixin is used by
element declarations and complex
type definitions which may be
named but only referenceable within a specific scope.
- pyxb.xmlschema.structures._AttributeWildcard_mixin provides support
for attribute group definitions and
complex type definitions, both of
which allow wildcard
attributes.