xsd.ComplexTypeDefinition

xsd.ComplexTypeDefinition objects provide for:

  • Constraining xml.ElementInformationItem objects by providing xsd.AttributeDeclaration objects governing the appearance and content of attributes.

  • Constraining xml.ElementInformationItem children to be empty, or to conform to a specified element-only or mixed content model, or else constraining the xml.CharDataInformationItem children to conform to a specified xsd.SimpleTypeDefinition.

  • Constraining elements and attributes to exist, not to exist, or to have specified values, with xsd.Assertion objects.

  • Using the mechanisms of Type Definition Hierarchy to derive a xsd.ComplexTypeDefinition from another xsd.SimpleTypeDefinition or xsd.ComplexTypeDefinition.

  • Specifying post-schema-validation infoset contributions for xml.ElementInformationItem objects.

  • Limiting the ability to derive additional types from a given xsd.ComplexTypeDefinition.

  • Controlling the permission to substitute, in an instance, elements of a derived type for elements declared in a content model to be of a given complex type.

Base class: xsd.TypeDefinition -> xsd.Component

class xsd.ComplexTypeDefinition

Proper instances of this class will be created within RaptorXML only, instantiation from script code will throw a NotImplementedError exception.

Attributes

xsd.ComplexTypeDefinition.abstract

Returns True if the xsd.ComplexTypeDefinition is abstract, False otherwise. xsd.ComplexTypeDefinition objects for which abstract is true have no valid instances and thus cannot be used in the normal way as the type definition for the validation of xml.ElementInformationItem objects (if for some reason an abstract type is identified as the governing type definition of an xml.ElementInformationItem, the item will invariably be invalid). It follows that such abstract types must not be referenced from an xsi:type attribute in an instance document. Abstract xsd.ComplexTypeDefinition objects can be used as base type definitions, or even as the declared type definitions of xsd.ElementDeclaration objects, provided in every case a concrete derived type definition is used for validation, either via xsi:type or the operation of a substitution group.

xsd.ComplexTypeDefinition.annotations

Returns an iterator of xsd.Annotation components.

xsd.ComplexTypeDefinition.assertions

Returns an iterator of xsd.Assertion schema components. The assertions property constrain elements and attributes to exist, not to exist, or to have specified values. Though specified as a sequence, the order among the Assertions is not significant during assessment.

xsd.ComplexTypeDefinition.attribute_uses

Returns an iterator of xsd.AttributeUse schema components. The attribute_uses and attribute_wildcard properties specifiy which xml.AttributeInformationItem objects are permitted on xml.ElementInformationItem objects validated by this xsd.ComplexTypeDefinition.

xsd.ComplexTypeDefinition.attribute_wildcard

Returns an xsd.AnyAttribute schema component, or None if no attribute wildcard is specified for this xsd.ComplexTypeDefinition. Attribute wildcards provide a more flexible specification for validation of attributes not explicitly included in attribute_uses.

xsd.ComplexTypeDefinition.base_type_definition

Returns the base type definition of this xsd.ComplexTypeDefinition. Each xsd.ComplexTypeDefinition is derived from a base type definition which is itself either a xsd.SimpleTypeDefinition or a xsd.ComplexTypeDefinition.

xsd.ComplexTypeDefinition.content_type

Returns the xsd.ContentType property record for this xsd.ComplexTypeDefinition.

The xsd.ContentType determines the validation of children of xml.ElementInformationItem objects.

  • A xsd.ContentType with variety xsd.ContentTypeVariety.EMPTY validates elements with no xml.CharDataInformationItem

or xml.ElementInformationItem children.

  • A xsd.ContentType with variety xsd.ContentTypeVariety.SIMPLE validates elements with character-only children

using its xsd.SimpleTypeDefinition.

  • A xsd.ContentType with variety xsd.ContentTypeVariety.ELEMENT_ONLY validates elements with children that

conform to the content model supplied by its xsd.Particle.

  • A xsd.ContentType with variety xsd.ContentTypeVariety.MIXED validates elements whose element children

(i.e. specifically ignoring other children such as xml.CharDataIinformationItem objects) conform to the content model supplied by its xsd.Particle.

and others conforming to the xsd.OpenContent.

xsd.ComplexTypeDefinition.context

Returns the context of this xsd.ComplexTypeDefinition. Required if name is absent, otherwise must be None. Either an xsd.ElementDeclaration or a xsd.ComplexTypeDefinition.

xsd.ComplexTypeDefinition.derivation_method

Returns the means of derivation of this xsd.ComplexTypeDefinition. This is either xsd.DerivationMethod.EXTENSION or xsd.DerivationMethod.RESTRICTION.

xsd.Component.element

Returns the xml.ElementInformationItem representing this schema component.

xsd.ComplexTypeDefinition.final

Returns a subset of {xsd.FinalValue.EXTENSION, xsd.FinalValue.RESTRICTION}. A xsd.ComplexTypeDefinition with an empty specification for final can be used as a base type definition for other types derived by either of extension or restriction; the explicit values xsd.FinalValue.EXTENSION, and xsd.FinalValue.RESTRICTION prevent further derivations by extension and restriction respectively.

xsd.Component.id

Returns the value of the ‘id’ attribute as a string, or None if the schema component’s XML element doesn’t have an ‘id’ attribute.

xsd.ComplexTypeDefinition.name

Returns the name of the xsd.ComplexTypeDefinition.

xsd.ComplexTypeDefinition.prohibited_substitutions

Returns a subset of {xsd.BlockValue.EXTENSION, xsd.BlockValue.RESTRICTION}. The xsd.ComplexTypeDefinition.prohibited_substitutions property of a xsd.ComplexTypeDefinition T determines whether type definitions derived from T are or are not validly substitutable for T.

  • If prohibited_substitutions contains xsd.BlockValue.RESTRICTION, then no type definition is validly substitutable

for T if its derivation from T involves any restriction steps.

  • If prohibited_substitutions contains xsd.BlockValue.EXTENSION, then no type definition is validly substitutable for

T if its derivation from T involves any extension steps.

xsd.ComplexTypeDefinition.qname

Returns a xml.QName object representing the name and target_namespace pair of the component.

xsd.ComplexTypeDefinition.target_namespace

Returns the target namespace of the xsd.ComplexTypeDefinition.

Methods

xsd.TypeDefinition.is_derived_from(TypeDefinition typeDef)

Returns True if this xsd.TypeDefinition is derived from other, False otherwise.

Special methods

__bool__, __eq__, __ge__, __gt__, __le__, __lt__, __ne__