# pyxb.xmlschema package

## Submodules

## pyxb.xmlschema.structures module

Classes corresponding to W3C XML Schema components.

Class names and behavior should conform to the schema components described in U{XML Schema Part 1: Structures<http://www.w3.org/TR/xmlschema-1/>}. References to sections in the documentation of this module generally refers to that document.

Each class has a C{CreateFromDOM} class method that creates an instance and initializes it from a DOM node. Only the L{Wildcard}, L{Particle}, and L{ModelGroup} components are created from non-DOM sources. However, the requirements on DOM interface are restricted to attributes, child nodes, and basic fields, though all these must support namespaces.

@group Mixins: _mixin @group Ur Type Specializations: *UrType @group Utilities: _ImportElementInformationItem

class `pyxb.xmlschema.structures.``Annotation`(**kw)

  Bases: `pyxb.xmlschema.structures._SchemaComponent_mixin`

  An XMLSchema U{Annotation<http://www.w3.org/TR/xmlschema-1/#cAnnotation>} component.

  classmethod `CreateFromDOM`(node, **kw)
  `_Annotation__RemoveMultiQuote_re` = re.compile('""+')
  `_Annotation__applicationInformation` = None
  `_Annotation__attributes` = None
  `_Annotation__userInformation` = None
  `applicationInformation`()
  `asDocString`()

    Return the text in a form suitable for embedding in a triple-double-quoted docstring.

    Any sequence of two or more double quotes is replaced by a sequence of single quotes that is the same length. Following this, spaces are added at the start and the end as necessary to ensure a double quote does not appear in those positions.

  `text`()
  `userInformation`()

class `pyxb.xmlschema.structures.``AttributeDeclaration`(*args, **kw)

  Bases: `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.xmlschema.structures._NamedComponent_mixin`, `pyxb.namespace.resolution._Resolvable_mixin`, `pyxb.xmlschema.structures._Annotated_mixin`, `pyxb.xmlschema.structures._ValueConstraint_mixin`, `pyxb.xmlschema.structures._ScopedDeclaration_mixin`

  An XMLSchema U{Attribute Declaration<http://www.w3.org/TR/xmlschema-1/#cAttribute_Declarations>} component.

  classmethod `CreateBaseInstance`(name, schema, std=None)

    Create an attribute declaration component for a specified namespace.

  classmethod `CreateFromDOM`(node, **kw)

    Create an attribute declaration from the given DOM node.

    wxs is a Schema instance within which the attribute is being declared.

    node is a DOM element. The name must be one of ( ‘all’, ‘choice’, ‘sequence’ ), and the node must be in the XMLSchema namespace.

    scope is the _ScopeDeclaration_mxin context into which the attribute declaration is placed. It can be SCOPE_global, a complex type definition, or XSCOPE_indeterminate if this is an anonymous declaration within an attribute group. It is a required parameter for this function.

  `_AttributeDeclaration__typeDefinition` = None
  `_AttributeDeclaration__typeExpandedName` = None
  `_bindingRequires_vx`(include_lax)

    Attribute declarations require their type.

  `_resolve`()
  `_updateFromOther_csc`(other)

    Override fields in this instance with those from the other.

    This method is invoked only by Schema._addNamedComponent, and then only when a built-in type collides with a schema-defined type. Material like facets is not (currently) held in the built-in copy, so the DOM information is copied over to the built-in STD, which is subsequently re-resolved.

    Returns self.

  `isResolved`()
  `typeDefinition`()

    The simple type definition to which an attribute value must conform.

class `pyxb.xmlschema.structures.``AttributeGroupDefinition`(*args, **kw)

  Bases: `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.xmlschema.structures._NamedComponent_mixin`, `pyxb.namespace.resolution._Resolvable_mixin`, `pyxb.xmlschema.structures._Annotated_mixin`, `pyxb.xmlschema.structures._AttributeWildcard_mixin`

  An XMLSchema U{Attribute Group Definition<http://www.w3.org/TR/xmlschema-1/#cAttribute_Group_Definitions>} component.

  classmethod `CreateBaseInstance`(name, schema, attribute_uses)

    Create an attribute declaration component for a specified namespace.

  classmethod `CreateFromDOM`(node, **kw)

    Create an attribute group definition from the given DOM node.

  `_AttributeGroupDefinition__PrivateTransient` = {'attributeGroupNames', 'anyAttribute'}
  `_AttributeGroupDefinition__anyAttribute` = None
  `_AttributeGroupDefinition__attributeGroupNames` = None
  `_AttributeGroupDefinition__attributeUses` = None
  `_AttributeGroupDefinition__isResolved` = False
  `_bindingRequires_vx`(include_lax)

    Attribute group declarations require their uses, but only if lax.

  `_resolve`()
  `attributeUses`()
  `isResolved`()

class `pyxb.xmlschema.structures.``AttributeUse`(**kw)

  Bases: `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.namespace.resolution._Resolvable_mixin`, `pyxb.xmlschema.structures._ValueConstraint_mixin`

  An XMLSchema U{Attribute Use<http://www.w3.org/TR/xmlschema-1/#cAttribute_Use>} component.

  classmethod `CreateBaseInstance`(schema, attribute_declaration, use=2)
  classmethod `CreateFromDOM`(node, **kw)

    Create an Attribute Use from the given DOM node.

    wxs is a Schema instance within which the attribute use is being defined.

    node is a DOM element. The name must be ‘attribute’, and the node must be in the XMLSchema namespace.

    scope is the _ScopeDeclaration_mixin context into which any required anonymous attribute declaration is put. This must be a complex type definition, or None if this use is in an attribute group.

  `USE_optional` = 2
  `USE_prohibited` = 4
  `USE_required` = 1
  `_AttributeUse__attributeDeclaration` = None
  `_AttributeUse__refExpandedName` = None
  `_AttributeUse__restrictionOf` = None
  `_AttributeUse__use` = None
  `_adaptForScope`(ctd)

    Adapt this instance for the given complex type.

    If the attribute declaration for this use is not associated with a complex type definition, then associate a clone of it with this CTD, and clone a new attribute use that uses the associated declaration. This attribute use is then inherited by extensions and restrictions, while retaining its original scope.

  `_bindingRequires_vx`(include_lax)

    Attribute uses require their declarations, but only if lax.

  `_resolve`()
  `_setRestrictionOf`(au)
  `attributeDeclaration`()

    The attribute declaration for this use.

    When the use scope is assigned, the declaration is cloned (if necessary) so that each declaration corresponds to only one use. We rely on this in code generation, because the template map for the use is stored in its declaration.

  `isResolved`()
  `matchingQNameMembers`(au_set)

    Return the subset of au_set for which the use names match this use.

  `prohibited`()
  `required`()
  `restrictionOf`()

class `pyxb.xmlschema.structures.``ComplexTypeDefinition`(*args, **kw)

  Bases: `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.xmlschema.structures._NamedComponent_mixin`, `pyxb.namespace.resolution._Resolvable_mixin`, `pyxb.xmlschema.structures._Annotated_mixin`, `pyxb.xmlschema.structures._AttributeWildcard_mixin`

  `CT_ELEMENT_ONLY` = 'ELEMENT_ONLY'
  `CT_EMPTY` = 'EMPTY'
  `CT_MIXED` = 'MIXED'
  `CT_SIMPLE` = 'SIMPLE'
  classmethod `CreateFromDOM`(node, **kw)
  `DM_empty` = 0
  `DM_extension` = 1
  `DM_restriction` = 2
  classmethod `UrTypeDefinition`(schema=None, in_builtin_definition=False)

    Create the ComplexTypeDefinition instance that approximates the ur-type.

    See section 3.4.7.

  `_ComplexTypeDefinition__PrivateTransient` = {'attributeGroups', 'ckw', 'attributeGroupNames', 'usesC1C2', 'usesC1', 'anyAttribute', 'ctscRestrictionNode'}
  `_ComplexTypeDefinition__UrTypeDefinition` = <pyxb.xmlschema.structures._UrTypeDefinition object>
  `_ComplexTypeDefinition__abstract` = False
  `_ComplexTypeDefinition__annotations` = None
  `_ComplexTypeDefinition__anyAttribute` = None
  `_ComplexTypeDefinition__attributeGroupNames` = None
  `_ComplexTypeDefinition__attributeGroups` = None
  `_ComplexTypeDefinition__attributeUses` = None
  `_ComplexTypeDefinition__baseExpandedName` = None
  `_ComplexTypeDefinition__baseTypeDefinition` = None
  `_ComplexTypeDefinition__ckw` = None
  `_ComplexTypeDefinition__completeProcessing`(method, content_style)
  `_ComplexTypeDefinition__complexContent`(method)
  `_ComplexTypeDefinition__contentStyle` = None
  `_ComplexTypeDefinition__contentType` = None
  `_ComplexTypeDefinition__ctscClause2STD` = None
  `_ComplexTypeDefinition__ctscRestrictionMode` = None
  `_ComplexTypeDefinition__ctscRestrictionNode` = None
  `_ComplexTypeDefinition__derivationMethod` = None
  `_ComplexTypeDefinition__effectiveContent` = None
  `_ComplexTypeDefinition__effectiveMixed` = None
  `_ComplexTypeDefinition__final` = 0
  `_ComplexTypeDefinition__isComplexContent` = None
  `_ComplexTypeDefinition__isResolved` = False
  `_ComplexTypeDefinition__localScopedDeclarations` = None
  `_ComplexTypeDefinition__prohibitedSubstitutions` = 0
  `_ComplexTypeDefinition__scopedAttributeDeclarations` = None
  `_ComplexTypeDefinition__scopedElementDeclarations` = None
  `_ComplexTypeDefinition__setComplexContentFromDOM`(type_node, content_node, definition_node_list, method, **kw)
  `_ComplexTypeDefinition__setContentFromDOM`(node, **kw)
  `_ComplexTypeDefinition__simpleContent`(method, **kw)
  `_ComplexTypeDefinition__usesC1` = None
  `_ComplexTypeDefinition__usesC1C2` = None
  `_DM_Map` = {'extension': 1, 'restriction': 2}
  `_bindingRequires_vx`(include_lax)

    Complex type definitions depend on their base type definition, the type definitions of any local attribute declarations, and if strict the type definitions of any local element declarations.

  `_contentTypeComponent`()
  `_contentTypeTag`()

    Return the value of the content type identifier, i.e. one of the CT_ constants. Return value is None if no content type has been defined.

  `_isComplexContent`()
  `_isHierarchyRoot`()

    Return C{True} iff this is the root of a complex type definition hierarchy.

  `_recordLocalDeclaration`(decl)

    Record the given declaration as being locally scoped in this type.

  `_resolve`()
  `_setDerivationMethod`(derivation_method)
  `_updateFromOther_csc`(other)

    Override fields in this instance with those from the other.

    This method is invoked only by Schema._addNamedComponent, and then only when a built-in type collides with a schema-defined type. Material like facets is not (currently) held in the built-in copy, so the DOM information is copied over to the built-in STD, which is subsequently re-resolved.

    Returns self.

  `abstract`()
  `attributeUses`()

    A frozenset() of AttributeUse instances.

  `baseTypeDefinition`()

    The type resolved from the base attribute.

  `contentType`()

    Identify the sort of content in this type.

    Valid values are:
      - C{CT_EMPTY}
      - ( C{CT_SIMPLE}, a L{SimpleTypeDefinition} instance )
      - ( C{CT_MIXED}, a L{Particle} instance )
      - ( C{CT_ELEMENT_ONLY}, a L{Particle} instance )
  `contentTypeAsString`()
  `derivationMethod`()

    How the type was derived.

  `hasWildcardElement`()

    Return True iff this type includes a wildcard element in its content model.

  `isBuiltin`()

    Indicate whether this simple type is a built-in type.

  `isResolved`()

    Indicate whether this complex type is fully defined.

    All built-in type definitions are resolved upon creation. Schema-defined type definitionss are held unresolved until the schema has been completely read, so that references to later schema-defined types can be resolved. Resolution is performed after the entire schema has been scanned and type-definition instances created for all topLevel{Simple,Complex}Types.

    If a built-in type definition is also defined in a schema (which it should be), the built-in definition is kept, with the schema-related information copied over from the matching schema-defined type definition. The former then replaces the latter in the list of type definitions to be resolved. See Schema._addNamedComponent.

  `localScopedDeclarations`(reset=False)

    Return a list of element and attribute declarations that were introduced in this definition (i.e., their scope is this CTD).

    @note: This specifically returns a list, with element declarations first, because name binding should privilege the elements over the attributes. Within elements and attributes, the components are sorted by expanded name, to ensure consistency across a series of binding generations.

    @keyword reset: If C{False} (default), a cached previous value (if it exists) will be returned.

  `lookupScopedAttributeDeclaration`(expanded_name)

    Find an attribute declaration with the given name that is local to this type.

    Returns None if there is no such local attribute declaration.

  `lookupScopedElementDeclaration`(expanded_name)

    Find an element declaration with the given name that is local to this type.

    Returns None if there is no such local element declaration.

  `pythonSupport`()

    Complex type definitions have no built-in type support.

class `pyxb.xmlschema.structures.``ElementDeclaration`(*args, **kw)

  Bases: `pyxb.xmlschema.structures._ParticleTree_mixin`, `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.xmlschema.structures._NamedComponent_mixin`, `pyxb.namespace.resolution._Resolvable_mixin`, `pyxb.xmlschema.structures._Annotated_mixin`, `pyxb.xmlschema.structures._ValueConstraint_mixin`, `pyxb.xmlschema.structures._ScopedDeclaration_mixin`

  An XMLSchema U{Element Declaration<http://www.w3.org/TR/xmlschema-1/#cElement_Declarations>} component.

  classmethod `CreateFromDOM`(node, **kw)

    Create an element declaration from the given DOM node.

    wxs is a Schema instance within which the element is being declared.

    scope is the _ScopeDeclaration_mixin context into which the element declaration is recorded. It can be SCOPE_global, a complex type definition, or None in the case of elements declared in a named model group.

    node is a DOM element. The name must be ‘element’, and the node must be in the XMLSchema namespace.

  `SGE_extension` = 1
  `SGE_none` = 0
  `SGE_restriction` = 2
  `SGE_substitution` = 4
  `_DS_Map` = {'extension': 1, 'restriction': 2, 'substitution': 4}
  `_ElementDeclaration__abstract` = False
  `_ElementDeclaration__disallowedSubstitutions` = 0
  `_ElementDeclaration__identityConstraintDefinitions` = None
  `_ElementDeclaration__isResolved` = False
  `_ElementDeclaration__nillable` = False
  `_ElementDeclaration__substitutionGroupAffiliation` = None
  `_ElementDeclaration__substitutionGroupExclusions` = 0
  `_ElementDeclaration__substitutionGroupExpandedName` = None
  `_ElementDeclaration__typeDefinition` = None
  `_ElementDeclaration__typeExpandedName` = None
  `_SGE_Map` = {'extension': 1, 'restriction': 2}
  `_adaptForScope`(owner, ctd)
  `_bindingRequires_vx`(include_lax)

    Element declarations depend on the type definition of their content.

  `_resolve`()
  `_typeDefinition`(type_definition)
  `_walkParticleTree`(visit, arg)
  `abstract`()
  `hasWildcardElement`()

    Return False, since element declarations are not wildcards.

  `identityConstraintDefinitions`()

    A list of IdentityConstraintDefinition instances.

  `isAdaptable`(ctd)

    Determine whether this element declaration is adaptable.

    OK, this gets ugly. First, if this declaration isn’t resolved, it’s clearly not adaptable.

    Now: For it to be adaptable, we must know enough about its type to verify that it is derivation-consistent with any other uses of the same name in the same complex type. If the element’s type is resolved, that’s good enough.

    If the element’s type isn’t resolved, we’re golden as long as type-equivalent types were used. But it’s also allowed for the derived ctd to use the element name constraining it to a derivation of the element base type. (Go see namespace http://www.opengis.net/ows/1.1 types PositionType, PositionType2D, BoundingBox, and WGS84BoundingBox for an example). So, we really do have to have the element’s type resolved.

    Except that if a CTD’s content incorporates an element with the same type as the CTD (i.e., nested), this will never happen, because the CTD can’t get resolved until after it has been resolved. (Go see {http://www.opengis.net/ows/1.1}ContentsBaseType and {http://www.opengis.net/ows/1.1}DatasetDescriptionSummaryBaseType for an example).

    So, we give the world a break and assume that if the type we’re trying to resolve is the same as the type of an element in that type, then the element type will be resolved by the point it’s needed. In point of fact, it won’t, but we’ll only notice that if a CTD contains an element whose type is a restriction of the CTD. In that case, isDerivationConsistent will blow chunks and somebody’ll have to come back and finish up this mess.

  `isResolved`()
  `nillable`()
  `substitutionGroupAffiliation`()

    None, or a reference to an ElementDeclaration.

  `typeDefinition`()

    The simple or complex type to which the element value conforms.

class `pyxb.xmlschema.structures.``IdentityConstraintDefinition`(*args, **kw)

  Bases: `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.xmlschema.structures._NamedComponent_mixin`, `pyxb.xmlschema.structures._Annotated_mixin`, `pyxb.namespace.resolution._Resolvable_mixin`

  An XMLSchema U{Identity Constraint Definition<http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions>} component.

  classmethod `CreateFromDOM`(node, **kw)
  `ICC_KEY` = 1
  `ICC_KEYREF` = 2
  `ICC_UNIQUE` = 4
  `_IdentityConstraintDefinition__annotations` = None
  `_IdentityConstraintDefinition__fields` = None
  `_IdentityConstraintDefinition__icc` = None
  `_IdentityConstraintDefinition__identityConstraintCategory` = None
  `_IdentityConstraintDefinition__isResolved` = False
  `_IdentityConstraintDefinition__referAttribute` = None
  `_IdentityConstraintDefinition__referencedKey` = None
  `_IdentityConstraintDefinition__selector` = None
  `_bindingRequires_vx`(include_lax)

    Constraint definitions that are by reference require the referenced constraint.

  `_resolve`()
  `annotations`()
  `fields`()
  `identityConstraintCategory`()
  `isResolved`()
  `selector`()

class `pyxb.xmlschema.structures.``ModelGroup`(compositor, particles, *args, **kw)

  Bases: `pyxb.xmlschema.structures._ParticleTree_mixin`, `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.xmlschema.structures._Annotated_mixin`

  An XMLSchema U{Model Group<http://www.w3.org/TR/xmlschema-1/#cModel_Group>} component.

  `C_ALL` = 1
  `C_CHOICE` = 2
  `C_INVALID` = 0
  `C_SEQUENCE` = 3
  classmethod `CompositorToString`(compositor)

    Map a compositor value to a string.

  classmethod `CreateFromDOM`(node, **kw)

    Create a model group from the given DOM node.

    wxs is a Schema instance within which the model group is being defined.

    node is a DOM element. The name must be one of ( ‘all’, ‘choice’, ‘sequence’ ), and the node must be in the XMLSchema namespace.

    scope is the _ScopeDeclaration_mxin context that is assigned to declarations that appear within the model group. It can be None, indicating no scope defined, or a complex type definition.

  classmethod `IsGroupMemberNode`(node)
  `_ModelGroup__compositor` = 0
  `_ModelGroup__modelGroupDefinition` = None
  `_ModelGroup__particles` = None
  `_adaptForScope`(owner, ctd)
  `_bindingRequires_vx`(include_lax)
  `_walkParticleTree`(visit, arg)
  `compositor`()
  `compositorToString`()

    Return a string representing the compositor value.

  `effectiveTotalRange`(particle)

    Return the minimum and maximum of the number of elements that can appear in a sequence matched by this particle.

    See U{http://www.w3.org/TR/xmlschema-1/#cos-seq-range}

  `hasWildcardElement`()

    Return True if the model includes a wildcard amongst its particles.

  `isAdaptable`(ctd)

    A model group has an unresolvable particle if any of its particles is unresolvable. Duh.

  `modelGroupDefinition`()

    The ModelGroupDefinition that names this group, or None if it is unnamed.

  `particles`()

class `pyxb.xmlschema.structures.``ModelGroupDefinition`(*args, **kw)

  Bases: `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.xmlschema.structures._NamedComponent_mixin`, `pyxb.xmlschema.structures._Annotated_mixin`

  An XMLSchema U{Model Group Definition<http://www.w3.org/TR/xmlschema-1/#cModel_Group_Definitions>} component.

  classmethod `CreateFromDOM`(node, **kw)

    Create a Model Group Definition from a DOM element node.

    wxs is a Schema instance within which the model group is being defined.

    node is a DOM element. The name must be ‘group’, and the node must be in the XMLSchema namespace. The node must have a ‘name’ attribute, and must not have a ‘ref’ attribute.

  `_ModelGroupDefinition__modelGroup` = None
  `_bindingRequires_vx`(include_lax)

    Model group definitions depend on the contained model group.

  `modelGroup`()

    The model group for which this definition provides a name.

class `pyxb.xmlschema.structures.``NotationDeclaration`(*args, **kw)

  Bases: `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.xmlschema.structures._NamedComponent_mixin`, `pyxb.xmlschema.structures._Annotated_mixin`

  An XMLSchema U{Notation Declaration<http://www.w3.org/TR/xmlschema-1/#cNotation_Declarations>} component.

  classmethod `CreateFromDOM`(node, **kw)
  `_NotationDeclaration__publicIdentifier` = None
  `_NotationDeclaration__systemIdentifier` = None
  `_bindingRequires_vx`(include_lax)
  `publicIdentifier`()
  `systemIdentifier`()

class `pyxb.xmlschema.structures.``Particle`(term, *args, **kw)

  Bases: `pyxb.xmlschema.structures._ParticleTree_mixin`, `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.namespace.resolution._Resolvable_mixin`

  An XMLSchema U{Particle<http://www.w3.org/TR/xmlschema-1/#cParticle>} component.

  classmethod `CreateFromDOM`(node, **kw)

    Create a particle from the given DOM node.

    wxs is a Schema instance within which the model group is being defined.

    node is a DOM element. The name must be one of ( ‘group’, ‘element’, ‘any’, ‘all’, ‘choice’, ‘sequence’ ), and the node must be in the XMLSchema namespace.

    scope is the _ScopeDeclaration_mxin context that is assigned to declarations that appear within the model group. It can be None, indicating no scope defined, or a complex type definition.

  classmethod `IsParticleNode`(node, *others)
  classmethod `IsTypedefNode`(node)
  `_Particle__maxOccurs` = 1
  `_Particle__minOccurs` = 1
  `_Particle__pendingTerm` = None
  `_Particle__refExpandedName` = None
  `_Particle__resolvableType` = None
  `_Particle__term` = None
  `_adaptForScope`(owner, ctd)
  `_bindingRequires_vx`(include_lax)
  `_resolve`()
  `_walkParticleTree`(visit, arg)
  `effectiveTotalRange`()

    Extend the concept of effective total range to all particles.

    See U{http://www.w3.org/TR/xmlschema-1/#cos-seq-range} and U{http://www.w3.org/TR/xmlschema-1/#cos-choice-range}

  `hasWildcardElement`()

    Return True iff this particle has a wildcard in its term.

    Note that the wildcard may be in a nested model group.

  `isAdaptable`(ctd)

    A particle has an unresolvable particle if it cannot be resolved, or if it has resolved to a term which is a model group that has an unresolvable particle.

  `isEmptiable`()

    Return C{True} iff this particle can legitimately match an empty sequence (no content).

    See U{http://www.w3.org/TR/xmlschema-1/#cos-group-emptiable}

  `isResolved`()
  `maxOccurs`()

    Upper limit on number of times the term may appear.

    If None, the term may appear any number of times; otherwise, this is an integral value indicating the maximum number of times the term may appear. The default value is 1; the value, unless None, must always be at least minOccurs().

  `minOccurs`()

    The minimum number of times the term may appear.

    Defaults to 1.

  `term`()

    A reference to a ModelGroup, Wildcard, or ElementDeclaration.

  `walkParticleTree`(visit, arg)

    The entry-point to walk a particle tree defining a content model.

    See L{_ParticleTree_mixin._walkParticleTree}.

class `pyxb.xmlschema.structures.``Schema`(*args, **kw)

  Bases: `pyxb.xmlschema.structures._SchemaComponent_mixin`

  An XMLSchema U{Schema<http://www.w3.org/TR/xmlschema-1/#Schemas>}.

  classmethod `CreateFromDOM`(node, namespace_context=None, schema_location=None, schema_signature=None, generation_uid=None, **kw)

    Take the root element of the document, and scan its attributes under the assumption it is an XMLSchema schema element. That means recognize namespace declarations and process them. Also look for and set the default namespace. All other attributes are passed up to the parent class for storage.

  classmethod `CreateFromDocument`(xmls, **kw)
  classmethod `CreateFromLocation`(**kw)

    Create a schema from a schema location.

    Reads an XML document from the schema location and creates a schema using it. All keyword parameters are passed to L{CreateFromDOM}.

    @keyword schema_location: A file path or a URI. If this is a relative URI and C{parent_uri} is present, the actual location will be L{normallzed<pyxb.utils.utility.NormalizeLocation>}. @keyword parent_uri: The context within which schema_location will be normalized, if necessary. @keyword absolute_schema_location: A file path or URI. This value is not normalized, and supersedes C{schema_location}.

  classmethod `CreateFromStream`(stream, **kw)
  `_QUALIFIED` = 'qualified'
  `_SA_All` = '#all'
  `_Schema__SchemaCategories` = ('typeDefinition', 'attributeGroupDefinition', 'modelGroupDefinition', 'attributeDeclaration', 'elementDeclaration', 'notationDeclaration', 'identityConstraintDefinition')
  `_Schema__TopLevelComponentMap` = {'attribute': <class 'pyxb.xmlschema.structures.AttributeDeclaration'>, 'attributeGroup': <class 'pyxb.xmlschema.structures.AttributeGroupDefinition'>, 'complexType': <class 'pyxb.xmlschema.structures.ComplexTypeDefinition'>, 'element': <class 'pyxb.xmlschema.structures.ElementDeclaration'>, 'group': <class 'pyxb.xmlschema.structures.ModelGroupDefinition'>, 'notation': <class 'pyxb.xmlschema.structures.NotationDeclaration'>, 'simpleType': <class 'pyxb.xmlschema.structures.SimpleTypeDefinition'>}
  `_Schema__addAttributeDeclaration`(ad)
  `_Schema__addAttributeGroupDefinition`(agd)
  `_Schema__addTypeDefinition`(td)
  `_Schema__annotations` = None
  `_Schema__attributeMap` = {<pyxb.namespace.ExpandedName object at 0x7f042e7bd208>: 'unqualified', <pyxb.namespace.ExpandedName object at 0x7f042e7bd390>: '', <pyxb.namespace.ExpandedName object at 0x7f042e7bd358>: 'unqualified', <pyxb.namespace.ExpandedName object at 0x7f042e7bd3c8>: '', <pyxb.namespace.ExpandedName object at 0x7f042e7bd400>: None, <pyxb.namespace.ExpandedName object at 0x7f042e7bd438>: None, <pyxb.namespace.ExpandedName object at 0x7f042e7bd470>: None, <pyxb.namespace.ExpandedName object at 0x7f042e7bd4a8>: None}
  `_Schema__defaultNamespace` = None
  `_Schema__ebvForNode`(attr, dom_node, candidate_map)
  `_Schema__generationUID` = None
  `_Schema__importEIIs` = None
  `_Schema__importedSchema` = None
  `_Schema__includedSchema` = None
  `_Schema__location` = None
  `_Schema__locationTag` = None
  `_Schema__namespaceData` = None
  `_Schema__originRecord` = None
  `_Schema__pastProlog` = False
  `_Schema__processAnnotation`(node)
  `_Schema__processImport`(node)

    Process an import directive.

    This attempts to locate schema (named entity) information for a namespace that is referenced by this schema.

  `_Schema__processInclude`(node)
  `_Schema__processRedefine`(node)
  `_Schema__processTopLevelNode`(node)

    Process a DOM node from the top level of the schema.

    This should return a non-None value if the node was successfully recognized.

  `_Schema__referencedNamespaces` = None
  `_Schema__requireInProlog`(node_name)

    Throw a SchemaValidationException referencing the given node if we have passed the sequence point representing the end of prolog elements.

  `_Schema__signature` = None
  `_Schema__targetNamespace` = None
  `_Schema__uriContentArchiveDirectory` = None
  `_UNQUALIFIED` = 'unqualified'
  `_addAnnotation`(annotation)
  `_addNamedComponent`(nc)
  `_setAttributeFromDOM`(attr)

    Override the schema attribute with the given DOM value.

  `_setAttributesFromMap`(attr_map)

    Override the schema attributes with values from the given map.

  `_uriContentArchiveDirectory`()
  `blockForNode`(dom_node, candidate_map)

    Return a bit mask indicating a set of options read from the node’s “block” attribute or the schema’s “blockDefault” attribute.

    A value of ‘#all’ means enable every options; otherwise, the attribute value should be a list of tokens, for which the corresponding value will be added to the return value.

    @param dom_node: the node from which the “block” attribute will be retrieved @type dom_node: C{xml.dom.Node} @param candidate_map: map from strings to bitmask values

  `defaultNamespace`()

    Default namespace of the schema.

    Will be None unless the schema has an ‘xmlns’ attribute. The value must currently be provided as a keyword parameter to the constructor.

  `finalForNode`(dom_node, candidate_map)

    Return a bit mask indicating a set of options read from the node’s “final” attribute or the schema’s “finalDefault” attribute.

    A value of ‘#all’ means enable every options; otherwise, the attribute value should be a list of tokens, for which the corresponding value will be added to the return value.

    @param dom_node: the node from which the “final” attribute will be retrieved @type dom_node: C{xml.dom.Node} @param candidate_map: map from strings to bitmask values

  `generationUID`()
  `importEIIs`()
  `importedSchema`()
  `includedSchema`()
  `location`()

    URI or path to where the schema can be found.

    For schema created by a user, the location should be provided to the constructor using the C{schema_location} keyword. In the case of imported or included schema, the including schema’s location is used as the base URI for determining the absolute URI of the included schema from its (possibly relative) location value. For files, the scheme and authority portions are generally absent, as is often the abs_path part.

  `locationTag`()
  `originRecord`()
  `referencedNamespaces`()
  `schemaAttribute`(attr_name)

    Return the schema attribute value associated with the given (nc)name.

    @param attr_name: local name for the attribute in the schema element. @return: the value of the corresponding attribute, or C{None} if it has not been defined and has no default. @raise KeyError: C{attr_name} is not a valid attribute for a C{schema} element.

  `schemaHasAttribute`(attr_name)

    Return True iff the schema has an attribute with the given (nc)name.

  `signature`()
  `targetNamespace`()

    The targetNamespace of a componen.

    This is None, or a reference to a Namespace in which the component is declared (either as a global or local to one of the namespace’s complex type definitions). This is immutable after creation.

  `targetNamespaceForNode`(dom_node, declaration_type)

    Determine the target namespace for a local attribute or element declaration.

    Look at the node’s C{form} attribute, or if none the schema’s C{attributeFormDefault} or C{elementFormDefault} value. If the resulting value is C{“qualified”} and the parent schema has a non-absent target namespace, return it to use as the declaration target namespace. Otherwise, return None to indicate that the declaration has no namespace.

    @param dom_node: The node defining an element or attribute declaration @param declaration_type: Either L{AttributeDeclaration} or L{ElementDeclaration} @return: L{pyxb.namespace.Namespace} or None

class `pyxb.xmlschema.structures.``SimpleTypeDefinition`(*args, **kw)

  Bases: `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.xmlschema.structures._NamedComponent_mixin`, `pyxb.namespace.resolution._Resolvable_mixin`, `pyxb.xmlschema.structures._Annotated_mixin`

  An XMLSchema U{Simple Type Definition<http://www.w3.org/TR/xmlschema-1/#Simple_Type_Definitions>} component.

  classmethod `CreateDerivedInstance`(name, schema, parent_std, python_support)

    Create a derived simple type in the target namespace.

    This is used to pre-load standard built-in derived types. You can use it for your own schemas as well, if you have special types that require explicit support to for Pythonic conversion.

  classmethod `CreateFromDOM`(node, **kw)
  classmethod `CreateListInstance`(name, schema, item_std, python_support)

    Create a list simple type in the target namespace.

    This is used to preload standard built-in list types. You can use it for your own schemas as well, if you have special types that require explicit support to for Pythonic conversion; but note that such support is identified by the item_std.

  classmethod `CreatePrimitiveInstance`(name, schema, python_support)

    Create a primitive simple type in the target namespace.

    This is mainly used to pre-load standard built-in primitive types, such as those defined by XMLSchema Datatypes. You can use it for your own schemas as well, if you have special types that require explicit support to for Pythonic conversion.

    All parameters are required and must be non-None.

  classmethod `CreateUnionInstance`(name, schema, member_stds)

    (Placeholder) Create a union simple type in the target namespace.

    This function has not been implemented.

  `STD_empty` = 0
  `STD_extension` = 1
  `STD_list` = 2
  `STD_restriction` = 4
  `STD_union` = 8
  classmethod `SimpleUrTypeDefinition`(schema=None, in_builtin_definition=False)

    Create the SimpleTypeDefinition instance that approximates the simple ur-type.

    See section 3.14.7.

  `VARIETY_absent` = 1
  `VARIETY_atomic` = 2
  `VARIETY_list` = 3
  `VARIETY_union` = 4
  classmethod `VarietyToString`(variety)

    Convert a variety value to a string.

  classmethod `_CreateXMLInstance`(name, schema)

    Create STD instances for built-in types.

    For example, xml:space is a restriction of NCName; xml:lang is a union.

  `_DA_empty` = 'none specified'
  `_DA_list` = 'list'
  `_DA_restriction` = 'restriction'
  `_DA_union` = 'union'
  classmethod `_FinalToString`(final_value)

    Convert a final value to a string.

  `_STD_Map` = {'extension': 1, 'list': 2, 'restriction': 4, 'union': 8}
  `_SimpleTypeDefinition__SimpleUrTypeDefinition` = <pyxb.xmlschema.structures._SimpleUrTypeDefinition object>
  `_SimpleTypeDefinition__baseExpandedName` = None
  `_SimpleTypeDefinition__baseTypeDefinition` = None
  `_SimpleTypeDefinition__completeResolution`(body, variety, alternative)
  `_SimpleTypeDefinition__defineDefaultFacets`(variety)

    Create facets for varieties that can take facets that are undeclared.

    This means unions, which per section 4.1.2.3 of http://www.w3.org/TR/xmlschema-2/ can have enumeration or pattern restrictions.

  `_SimpleTypeDefinition__derivationAlternative` = None
  `_SimpleTypeDefinition__domNode` = None
  `_SimpleTypeDefinition__facets` = None
  `_SimpleTypeDefinition__final` = 0
  `_SimpleTypeDefinition__fundamentalFacets` = None
  `_SimpleTypeDefinition__initializeFromList`(body, **kw)
  `_SimpleTypeDefinition__initializeFromRestriction`(body, **kw)
  `_SimpleTypeDefinition__initializeFromUnion`(body, **kw)
  `_SimpleTypeDefinition__isBuiltin` = False
  `_SimpleTypeDefinition__itemTypeDefinition` = None
  `_SimpleTypeDefinition__itemTypeExpandedName` = None
  `_SimpleTypeDefinition__localFacets` = None
  `_SimpleTypeDefinition__localMemberTypes` = None
  `_SimpleTypeDefinition__memberTypeDefinitions` = None
  `_SimpleTypeDefinition__memberTypes` = None
  `_SimpleTypeDefinition__memberTypesExpandedNames` = None
  `_SimpleTypeDefinition__primitiveTypeDefinition` = None
  `_SimpleTypeDefinition__processHasFacetAndProperty`(variety)

    Identify the facets and properties for this stype.

    This method simply identifies the facets that apply to this specific type, and records property values. Only explicitly-associated facets and properties are stored; others from base types will also affect this type. The information is taken from the applicationInformation children of the definition’s annotation node, if any. If there is no support for the XMLSchema_hasFacetAndProperty namespace, this is a no-op.

    Upon return, self.__facets is a map from the class for an associated fact to None, and self.__fundamentalFacets is a frozenset of instances of FundamentalFacet.

    The return value is self.

  `_SimpleTypeDefinition__pythonSupport` = None
  `_SimpleTypeDefinition__resolveBuiltin`()
  `_SimpleTypeDefinition__singleSimpleTypeChild`(body, other_elts_ok=False)
  `_SimpleTypeDefinition__updateFacets`(body)
  `_SimpleTypeDefinition__variety` = None
  `_bindingRequires_vx`(include_lax)

    Implement base class method.

    This STD depends on its baseTypeDefinition, unless its variety is absent. Other dependencies are on item, primitive, or member type definitions.

  `_createRestriction`(owner, body)

    Create a new simple type with this as its base.

    The type is owned by the provided owner, and may have facet restrictions defined by the body. @param owner: the owner for the newly created type @type owner: L{ComplexTypeDefinition} @param body: the DOM node from which facet information will be extracted @type body: C{xml.dom.Node} @rtype: L{SimpleTypeDefinition}

  `_derivationAlternative`()
  `_resolve`()

    Attempt to resolve the type.

    Type resolution for simple types means that the corresponding schema component fields have been set. Specifically, that means variety, baseTypeDefinition, and the appropriate additional fields depending on variety.

    All built-in STDs are resolved upon creation. Schema-defined STDs are held unresolved until the schema has been completely read, so that references to later schema-defined STDs can be resolved. Resolution is performed after the entire schema has been scanned and STD instances created for all topLevelSimpleTypes.

    If a built-in STD is also defined in a schema (which it should be for XMLSchema), the built-in STD is kept, with the schema-related information copied over from the matching schema-defined STD. The former then replaces the latter in the list of STDs to be resolved.

    Types defined by restriction have the same variety as the type they restrict. If a simple type restriction depends on an unresolved type, this method simply queues it for resolution in a later pass and returns.

  `_setPythonSupport`(python_support)
  `_updateFromOther_csc`(other)

    Override fields in this instance with those from the other.

    This method is invoked only by Schema._addNamedComponent, and then only when a built-in type collides with a schema-defined type. Material like facets is not (currently) held in the built-in copy, so the DOM information is copied over to the built-in STD, which is subsequently re-resolved.

    Returns self.

  `baseTypeDefinition`()
  `facets`()
  `fundamentalFacets`()

    A frozenset of instances of facets.FundamentallFacet.

  `hasPythonSupport`()
  `isBuiltin`()

    Indicate whether this simple type is a built-in type.

  `isResolved`()

    Indicate whether this simple type is fully defined.

    Type resolution for simple types means that the corresponding schema component fields have been set. Specifically, that means variety, baseTypeDefinition, and the appropriate additional fields depending on variety. See _resolve() for more information.

  `itemTypeDefinition`()
  `memberTypeDefinitions`()
  `primitiveTypeDefinition`(throw_if_absent=True)
  `pythonSupport`()
  `pythonToString`(value)
  `stringToPython`(string)
  `variety`()

class `pyxb.xmlschema.structures.``Wildcard`(*args, **kw)

  Bases: `pyxb.xmlschema.structures._ParticleTree_mixin`, `pyxb.xmlschema.structures._SchemaComponent_mixin`, `pyxb.xmlschema.structures._Annotated_mixin`

  An XMLSchema U{Wildcard<http://www.w3.org/TR/xmlschema-1/#cParticle>} component.

  classmethod `CreateFromDOM`(node, **kw)
  classmethod `IntensionalIntersection`(constraints)

    http://www.w3.org/TR/xmlschema-1/#cos-aw-intersect

  classmethod `IntensionalUnion`(constraints)

    http://www.w3.org/TR/xmlschema-1/#cos-aw-union

  `NC_any` = '##any'
  `NC_local` = '##local'
  `NC_not` = '##other'
  `NC_targetNamespace` = '##targetNamespace'
  `PC_lax` = 'lax'
  `PC_skip` = 'skip'
  `PC_strict` = 'strict'
  `_Wildcard__namespaceConstraint` = None
  `_Wildcard__processContents` = None
  `_adaptForScope`(owner, ctd)

    Wildcards are scope-independent; return self

  `_walkParticleTree`(visit, arg)
  `hasWildcardElement`()

    Return True, since Wildcard components are wildcards.

  `isAdaptable`(ctd)
  `namespaceConstraint`()

    A constraint on the namespace for the wildcard.

    Valid values are:
      - L{Wildcard.NC_any}
      - A tuple ( L{Wildcard.NC_not}, a_namespace )
      - set(of_namespaces)

    Note that namespace are represented by L{Namespace<pyxb.namespace.Namespace>} instances, not the URIs that actually define a namespace. Absence of a namespace is represented by C{None}, both in the “not” pair and in the set.

  `processContents`()

`pyxb.xmlschema.structures.``_AddSimpleTypes`(namespace)

  Add to the schema the definitions of the built-in types of XMLSchema. This should only be invoked by L{pyxb.namespace} when the built-in namespaces are initialized.

class `pyxb.xmlschema.structures.``_Annotated_mixin`(*args, **kw)

  Bases: `pyxb.cscRoot`

  Mix-in that supports an optional single annotation that describes the component.

  Most schema components have annotations. The ones that don’t are L{AttributeUse}, L{Particle}, and L{Annotation}. L{ComplexTypeDefinition} and L{Schema} support multiple annotations, so do not mix-in this class.

  `_Annotated_mixin__annotation` = None
  `_annotationFromDOM`(node)
  `_updateFromOther_csc`(other)

    Override fields in this instance with those from the other.

    Post-extended; description in leaf implementation in ComplexTypeDefinition and SimpleTypeDefinition.

  `annotation`()

class `pyxb.xmlschema.structures.``_AttributeWildcard_mixin`(*args, **kw)

  Bases: `pyxb.cscRoot`

  Support for components that accept attribute wildcards.

  That is L{AttributeGroupDefinition} and L{ComplexTypeDefinition}. The calculations of the appropriate wildcard are sufficiently complex that they need to be abstracted out to a mix-in class.

  classmethod `CompleteWildcard`(namespace_context, attribute_groups, local_wildcard)

    Implement the algorithm as described the U{specification<http://www.w3.org/TR/xmlschema-1/#declare-type>}.

    @param namespace_context: The L{pyxb.namespace.NamespaceContext} to be associated with any created L{Wildcard} instance @param attribute_groups: A list of L{AttributeGroupDefinition} instances @param local_wildcard: A L{Wildcard} instance computed from a relevant XMLSchema C{anyAttribute} element, or C{None} if no attribute wildcard is relevant

  `_AttributeWildcard_mixin__attributeWildcard` = None
  `_attributeRelevantChildren`(node_list)

    Return the nodes that are relevant for attribute processing.

    @param node_list: A sequence of nodes found in a definition content information item.

    @return: A tuple C{( attributes, attributeGroups, attributeWildcard)} where C{attributes} is the subsequence of C{node_list} that are XMLSchema C{attribute} nodes; C{attributeGroups} is analogous; and C{attributeWildcard} is a single DOM node with XMLSchema name C{anyAttribute} (or C{None}, if no such node is present in the list).

    @raise pyxb.SchemaValidationError: An C{attributeGroup} node is present but does not have the required C{ref} attribute. @raise pyxb.SchemaValidationError: Multiple C{anyAttribute} nodes are identified.

  `_setAttributeWildcard`(attribute_wildcard)

    Set the attribute wildcard property for this instance.

  `attributeWildcard`()

    Return the L{Wildcard} component associated with attributes of this instance, or C{None} if attribute wildcards are not present in the instance.

class `pyxb.xmlschema.structures.``_ImportElementInformationItem`(importing_schema, node, **kw)

  Bases: `pyxb.xmlschema.structures._Annotated_mixin`

  Data associated with an U{import<http://www.w3.org/TR/xmlschema-1/#composition-schemaImport>} statement within a schema.

  `_ImportElementInformationItem__id` = None
  `_ImportElementInformationItem__namespace` = None
  `_ImportElementInformationItem__prefix` = None
  `_ImportElementInformationItem__schema` = None
  `_ImportElementInformationItem__schemaLocation` = None
  `id`()

    The value of the C{id} attribute from the import statement.

  `namespace`()

    The L{pyxb.namespace.Namespace} instance corresponding to the value of the C{namespace} attribute from the import statement.

  `prefix`()

    The prefix from a namespace declaration for L{namespace} that was active in the context of the import element, or C{None} if there was no relevant namespace declaration in scope at that point.

    This is propagated to be used as the default prefix for the corresponding namespace if no prefix had been assigned.

  `schema`()

    The L{Schema} instance corresponding to the imported schema, if available.

    Normally C{import} statements will be fulfilled by loading components from a L{namespace archive<pyxb.namespace.NamespaceArchive>} in which the corresponding namespace is marked as public. Where there are cycles in the namespace dependency graph, or the schema for a namespace are associated with a restricted profile of another namespace, there may be no such archive and instead the components are obtained using this schema.

  `schemaLocation`()

    The value of the C{schemaLocation} attribute from the import statement, normalized relative to the location of the importing schema.

class `pyxb.xmlschema.structures.``_NamedComponent_mixin`(*args, **kw)

  Bases: `pyxb.utils.utility.PrivateTransient_mixin`, `pyxb.cscRoot`

  Mix-in to hold the name and targetNamespace of a component.

  The name may be None, indicating an anonymous component. The targetNamespace is never None, though it could be an empty namespace. The name and targetNamespace values are immutable after creation.

  This class overrides the pickling behavior: when pickling a Namespace, objects that do not belong to that namespace are pickled as references, not as values. This ensures the uniqueness of objects when multiple namespace definitions are pre-loaded.

  This class must follow L{_SchemaComponent_mixin} in the MRO.

  `_NamedComponent_mixin__AnonymousCategory` = '_anonymousTypeDefinition'
  `_NamedComponent_mixin__PrivateTransient` = {'schema'}
  `_NamedComponent_mixin__anonymousName` = None
  `_NamedComponent_mixin__bindingNamespace` = None
  `_NamedComponent_mixin__name` = None
  `_NamedComponent_mixin__needAnonymousSupport`()
  `_NamedComponent_mixin__pickleAsReference`()
  `_NamedComponent_mixin__schema` = None
  `_NamedComponent_mixin__targetNamespace` = None
  `_NamedComponent_mixin__templateMap` = None
  `_anonymousName`(namespace=None)
  `_bindsInNamespace`(ns)

    Return C{True} if the binding for this component should be generated in the given namespace.

    This is the case when the component is in the given namespace. It’s also the case when the component has no associated namespace (but not an absent namespace). Be aware that cross-namespace inheritance means you will get references to elements in another namespace when generating code for a subclass; that’s fine, and those references should not be generated locally.

  `_picklesInArchive`(archive)

    Return C{True} if this component should be pickled by value in the given namespace.

    When pickling, a declaration component is considered to belong to the namespace if it has a local scope which belongs to the namespace. In that case, the declaration is a clone of something that does not belong to the namespace; but the clone does.

    @see: L{_bindsInNamespace}

    @return: C{False} if the component should be pickled by reference.

  `_picklingReference`()
  `_prepareForArchive_csc`(module_record)
  `_resetClone_csc`(**kw)
  `_schema`()

    Return the schema component from which this component was defined.

    Needed so we can distinguish components that came from different locations, since that imposes an external order dependency on them and on cross-namespace inclusions.

    @note: This characteristic is removed when the component is stored in a namespace archive.

  `_setAnonymousName`(namespace, unique_id=None, anon_name=None)
  `_setBindingNamespace`(namespace)
  `_templateMap`()

    A map from template keys to component-specific values.

    This is used in code generation to maintain unique names for accessor methods, identifiers, keys, and other characteristics associated with the code generated in support of the binding for this component.

  `bindingNamespace`()

    The namespace in which this component’s binding is placed.

  `expandedName`()

    Return the L{pyxb.namespace.ExpandedName} of this object.

  `isAnonymous`()

    Return true iff this instance is locally scoped (has no name).

  `isDerivationConsistent`(other)

    Return True iff this type can serve as a restriction of the other type for the purposes of U{element consistency<http://www.w3.org/TR/xmlschema-1/#cos-element-consistent>}.

    It appears that name equivalence is normally used; two complex type definitions with identical structures are not considered equivalent (at least, per XMLSpy). However, some OpenGIS standards demonstrate that derivation by restriction from the other type is also acceptable. That opens a whole can of worms; see L{ElementDeclaration.isAdaptable}.

  `isNameEquivalent`(other)

    Return true iff this and the other component share the same name and target namespace.

    Anonymous components are inherently name inequivalent, except to themselves. This relies on equivalence as defined for pyxb.namespace.ExpandedName, for which None is not equivalent to any non-anonymous name.

  `isTypeEquivalent`(other)

    Return True iff this and the other component have matching types.

    It appears that name equivalence is used; two complex type definitions with identical structures are not considered equivalent (at least, per XMLSpy).

  `name`()

    Name of the component within its scope or namespace.

    This is an NCName. The value isNone if the component is anonymous. The attribute is immutable after the component is created creation.

  `targetNamespace`()

    The targetNamespace of a component.

    This is None, or a reference to a Namespace in which the component is declared (either as a global or local to one of the namespace’s complex type definitions). This is immutable after creation.

class `pyxb.xmlschema.structures.``_ParticleTree_mixin`(*args, **kw)

  Bases: `pyxb.cscRoot`

  `_walkParticleTree`(visit, arg)

    Mix-in supporting walks of L{Particle} trees.

    This invokes a provided function on each node in a tree defining the content model of a particle, both on the way down the tree and on the way back up. A standard implementation would be:

        def _walkParticleTree (self, visit, arg):
          visit(self, True, arg)
          self.__term.walkParticleTree(visit, arg)
          visit(self, False, arg)

    @param visit: A callable with parameters C{node, entering, arg} where C{node} is an instance of a class inheriting L{_ParticleTree_mixin}, C{entering} indicates tree transition status, and C{arg} is a caller-provided state parameter. C{entering} is C{True} if C{node} has particle children and the call is before they are visited; C{None} if the C{node} has no particle children; and C{False} if C{node} has particle children and they have been visited.

    @param arg: The caller-provided state parameter to be passed along with the node and entry/exit status in the invocation of C{visit}.

class `pyxb.xmlschema.structures.``_PickledAnonymousReference`(namespace, anonymous_name)

  Bases: `object`

  A helper that encapsulates a reference to an anonymous type in a different namespace.

  Normally references to components in other namespaces can be made using the component’s name. This is not the case when a namespace derives from a base type in another namespace and needs to reference the attribute or element declarations held in that type. If these declarations are local to the base complex type, they cannot be identified by name. This class provides a pickleable representation for them that behaves rather like an L{pyxb.namespace.ExpandedName} instance in that it can be used to dereference various component types.

  classmethod `FromPickled`(object_reference)

    Return the component referred to by the provided reference, regardless of whether it is a normal or anonymous reference.

  `_PickledAnonymousReference__AnonymousCategory` = '_anonymousTypeDefinition'
  `_PickledAnonymousReference__anonymousName` = None
  `_PickledAnonymousReference__lookupObject`()
  `_PickledAnonymousReference__namespace` = None
  `anonymousName`()
  `attributeDeclaration`()
  `attributeGroupDefinition`()
  `elementDeclaration`()
  `identityConstraintDefinition`()
  `modelGroupDefinition`()
  `namespace`()
  `notationDeclaration`()
  `typeDefinition`()
  `validateComponentModel`()

    Forward to the associated namespace.

class `pyxb.xmlschema.structures.``_SchemaComponent_mixin`(*args, **kw)

  Bases: `pyxb.namespace._ComponentDependency_mixin`, `pyxb.namespace.archive._ArchivableObject_mixin`, `pyxb.utils.utility.PrivateTransient_mixin`, `pyxb.utils.utility.Locatable_mixin`

  A mix-in that marks the class as representing a schema component.

  This exists so that we can determine the owning schema for any component we encounter. This is normally done at construction time by passing a C{schema=val} parameter to the constructor.

  `_SchemaComponent_mixin__PrivateTransient` = {'owner', 'namespaceContext', 'ownedComponent', 'clones', 'cloneSource', 'facStateSortKey'}
  `_SchemaComponent_mixin__cloneSource` = None
  `_SchemaComponent_mixin__clones` = None
  `_SchemaComponent_mixin__facStateSortKey` = None
  `_SchemaComponent_mixin__nameInBinding` = None
  `_SchemaComponent_mixin__namespaceContext` = None
  `_SchemaComponent_mixin__ownedComponents` = None
  `_SchemaComponent_mixin__owner` = None
  `_SchemaComponent_mixin__schemaOrderSortKey` = None
  `_SchemaComponent_mixin__scope` = None
  `_SchemaComponent_mixin__uniqueNameInBinding` = None
  `_clearNamespaceContext`()
  `_clone`(owner, origin)

    Create a copy of this instance suitable for adoption by some other component.

    This is used for creating a locally-scoped declaration from a declaration in a named model or attribute group.

  `_cloneSource`()

    The source component from which this is a clone.

    Returns C{None} if this is not a clone.

  `_clones`()

    The set of instances cloned from this component.

    Returns None if no instances have been cloned from this.

  `_dissociateFromNamespace`()

    Dissociate this component from its owning namespace.

    This should only be done whwen there are no other references to the component, and you want to ensure it does not appear in the model.

  `_namespaceContext`()

    The namespace context for this schema.

    This defines where it looks things up, where it puts things it creates, the in-scope namespace declarations, etc. Must be defined for anything that does any sort of QName interpretation. The value is generally a reference to a namespace context associated with the DOM element node corresponding to this component.

  `_resetClone_csc`(**kw)

    Virtual method to clear whatever attributes should be reset in a cloned component.

    This instance should be an instance created by copy.copy().

    The implementation in this class clears the owner and dependency relations.

    Returns C{self}.

  `_scope`()

    The context into which declarations in or subordinate to this node are placed.

  `_scopeIsGlobal`()

    Return True iff this component has global scope.

  `_scopeIsIndeterminate`()

    Return True iff nobody has defined a scope for this node.

  `_setFacStateSortKey`(key)

    Set the automata state sort key.

    @param key: the ordinal used for sorting.

  `_setOwner`(owner)

    Set the owner of this component.

    If C{owner} is C{None}, this has no effect. Otherwise, the component’s current owner must be either C{None} or the same as the input C{owner}.

  `_setScope`(ctd)

    Set the scope of this instance after construction.

    This should only be invoked on cloned declarations being incorporated into a complex type definition. Note that the source of the clone may be any scope: indeterminate if from a model (attribute) group definition; global if a reference to a global component; or ctd if inherited from a complex base type.

  `_updateFromOther_csc`(other)

    Override fields in this instance with those from the other.

    Post-extended; description in leaf implementation in ComplexTypeDefinition and SimpleTypeDefinition.

  `bestNCName`()

    Return the name of this component, as best it can be determined.

    For example, ModelGroup instances will be named by their ModelGroupDefinition, if available. Returns None if no name can be inferred.

  `facStateSortKey`()

    A sort key matching preferred content order.

    This is an ordinal (integer) used to control which candidate transitions are attempted first when testing symbols against the content automaton state.

    @note: The value associated with a node (especially a L{ModelGroup} or L{Particle} will be different for different complex types, and is valid only during generation of the automata code for a given type.

  `hasBinding`()

    Return C{True} iff this is a component which has a user-visible Python construct which serves as its binding.

    Type definitions have classes as their bindings. Global element declarations have instances of L{pyxb.binding.basis.element} as their bindings.

  `isTypeDefinition`()

    Return True iff this component is a simple or complex type definition.

  `isUrTypeDefinition`()

    Return True iff this component is a simple or complex type definition.

  `nameInBinding`()

    Return the name by which this component is known in the binding module.

    @note: To support builtin datatypes, type definitions with an associated L{pythonSupport<SimpleTypeDefinition.pythonSupport>} class initialize their binding name from the class name when the support association is created. As long as no built-in datatype conflicts with a language keyword, this should be fine.

  `owner`()
  `schemaOrderSortKey`()

    A key to be used when sorting components for binding generation.

    This is a tuple comprising the namespace URI, schema location, and line and column of the component definition within the schema. The purpose is to ensure consistent order of binding components in generated code, to simplify maintenance involving the generated sources.

    To support Python 3 values that are C{None} are replaced with the default value for whatever type belongs in the corresponding position: (uri:str, locbase:str, locline:int, loccol:int)

  `setNameInBinding`(name_in_binding)

    Set the name by which this component shall be known in the binding module.

  `setUniqueNameInBinding`(unique_name)

    Set the name by which this component shall be known in the binding class.

  `uniqueNameInBinding`()

    Return the name by which this component is known in the binding class.

class `pyxb.xmlschema.structures.``_ScopedDeclaration_mixin`(*args, **kw)

  Bases: `pyxb.cscRoot`

  Mix-in class for named components that have a scope.

  Scope is important when doing cross-namespace inheritance, e.g. extending or restricting a complex type definition that is from a different namespace. In this case, we will need to retain a reference to the external component when the schema is serialized.

  This is done in the pickling process by including the scope when pickling a component as a reference. The scope is the SCOPE_global if global; otherwise, it is a tuple containing the external namespace URI and the NCName of the complex type definition in that namespace. We assume that the complex type definition has global scope; otherwise, it should not have been possible to extend or restrict it. (Should this be untrue, there are comments in the code about a possible solution.)

  @warning: This mix-in must follow L{_NamedComponent_mixin} in the C{mro}.

  classmethod `IsValidScope`(value)
  `SCOPE_global` = 'global'
  classmethod `ScopeIsGlobal`(value)
  classmethod `ScopeIsIndeterminate`(value)
  `XSCOPE_indeterminate` = 'indeterminate'
  `_ScopedDeclaration_mixin__baseDeclaration` = None
  `_ScopedDeclaration_mixin__overridesParentScope` = False
  `_baseDeclaration`(referenced_declaration)
  `_overrideParentScope`(value)
  `_scopeIsCompatible`(scope)

    Return True if this scope currently assigned to this instance is compatible with the given scope.

    If either scope is indeterminate, presume they will ultimately be compatible. Scopes that are equal are compatible, as is a local scope if this already has a global scope.

  `baseDeclaration`()
  `overriddenDeclaration`()
  `overridesParentScope`()
  `scope`()

    The scope for the declaration.

    Valid values are SCOPE_global, or a complex type definition. A value of None means a non-global declaration that is not owned by a complex type definition. These can only appear in attribute group definitions, model group definitions, and element declarations.

    @todo: For declarations in named model groups (viz., local elements that aren’t references), the scope needs to be set by the owning complex type.

class `pyxb.xmlschema.structures.``_SimpleUrTypeDefinition`(*args, **kw)

  Bases: `pyxb.xmlschema.structures.SimpleTypeDefinition`, `pyxb.xmlschema.structures._Singleton_mixin`

  Subclass ensures there is only one simple ur-type.

  `__SimpleUrTypeDefinition__singleton` = <pyxb.xmlschema.structures._SimpleUrTypeDefinition object>

class `pyxb.xmlschema.structures.``_Singleton_mixin`(*args, **kw)

  Bases: `pyxb.cscRoot`

  This class is a mix-in which guarantees that only one instance of the class will be created. It is used to ensure that the ur-type instances are pointer-equivalent even when unpickling. See ComplexTypeDefinition.UrTypeDefinition().

class `pyxb.xmlschema.structures.``_UrTypeDefinition`(*args, **kw)

  Bases: `pyxb.xmlschema.structures.ComplexTypeDefinition`, `pyxb.xmlschema.structures._Singleton_mixin`

  Subclass ensures there is only one ur-type.

  `__UrTypeDefinition__singleton` = <pyxb.xmlschema.structures._UrTypeDefinition object>
  `_resolve`()
  `pythonSupport`()

    The ur-type does have a Python class backing it up.

class `pyxb.xmlschema.structures.``_ValueConstraint_mixin`(*args, **kw)

  Bases: `pyxb.cscRoot`

  Mix-in indicating that the component contains a simple-type value that may be constrained.

  `VC_default` = 1
  `VC_fixed` = 2
  `VC_na` = 0
  `_ValueConstraint_mixin__valueConstraint` = None
  `_valueConstraintFromDOM`(node)
  `default`()

    If this instance constraints a default value, return that value; otherwise return None.

  `fixed`()

    If this instance constraints a fixed value, return that value; otherwise return None.

  `valueConstraint`()

    A constraint on the value of the attribute or element.

    Either None, or a pair consisting of a string in the lexical space of the typeDefinition and one of VC_default and VC_fixed.

## Module contents

XMLSchema – Classes to support processing W3C XML Schema definitions.

This module supports processing DOM model representations of XML schema into a Python object representation of the schema component model.

The module also provides a top-level class that supports schema processing.