xsd

The xsd module provides a Python interface for the XML Schema 1.1 Structure and XML Schema 1.1 Datatypes specifications. This Python interface enables the user to navigate and access the XML Schema document and its components.

Classes

Enum Classes

class xsd.BlockValue

The xsd.BlockValue enumeration provides values for the xsd.ElementDeclaration.disallowed_substitutions property as well as for the xsd.ComplexTypeDefinition.prohibited_substitutions property.

BlockValue.EXTENSION

Disallow substitution with xsd.ComplexTypeDefinition objects derived by extension.

BlockValue.RESTRICTION

Disallow substitution with xsd.ComplexTypeDefinition objects derived by restriction.

BlockValue.SUBSTITUTION

Disallow substitution with potential substitution group members.

class xsd.ContentTypeVariety

The xsd.ContentTypeVariety enumeration provides values for the xsd.ContentType.variety property of the xsd.ContentType property record.

ContentTypeVariety.ELEMENT_ONLY

A xsd.ContentType with this variety validates elements with children that conform to the content model supplied by its xsd.Particle.

ContentTypeVariety.EMPTY

A xsd.ContentType with this variety validates elements with no xml.CharDataInformationItem or xml.ElementInformationItem children.

ContentTypeVariety.MIXED

A xsd.ContentType with this variety validates elements whose xml.ElementInformationItem children (i.e. specifically ignoring other children such as xml.CharDataInformationItem objects) conform to the content model supplied by its xsd.Particle.

ContentTypeVariety.SIMPLE

A xsd.ContentType with this variety validates elements with character-only children using its xsd.SimpleTypeDefinition.

class xsd.DerivationMethod

The xsd.DerivationMethod enumeration provides values for the xsd.ComplexTypeDefinition.derivation_method property.

DerivationMethod.EXTENSION

For xsd.ComplexTypeDefinition objects that are derived by extension.

DerivationMethod.RESTRICTION

For xsd.ComplexTypeDefinition objects that are derived by restriction.

class xsd.ExplicitTimezone

The xsd.ExplicitTimezone enumeration provides values for the xsd.ExplicitTimezoneFacet.value property.

ExplicitTimezone.OPTIONAL

The timezone offset is optional.

ExplicitTimezone.PROHIBITED

The timezone offset must be absent.

ExplicitTimezone.REQUIRED

The timezone offset is required.

class xsd.FinalValue

The xsd.FinalValue enumeration provides values for the substitution_group_exclusions property of xsd.ElementDeclaration objects as well as for the xsd.ComplexTypeDefinition.final and xsd.SimpleTypeDefinition.final properties.

FinalValue.EXTENSION

Prohibit derivation per extension.

FinalValue.LIST

Prohibit construction of lists.

FinalValue.RESTRICTION

Prohibit derivation per restriction.

FinalValue.UNION

Prohibit construction of unions.

class xsd.IdentityConstraintCategory

The xsd.IdentityConstraintCategory enumeration provides values for the xsd.IdentityConstraintDefinition.identity_constraint_category property.

IdentityConstraintCategory.KEY

The xsd.IdentityConstraintDefinition asserts uniqueness as for UNIQUE. KEY further asserts that all selected content actually has such tuples.

IdentityConstraintCategory.KEYREF

The xsd.IdentityConstraintDefinition asserts a correspondence, with respect to the content identified by selector, of the tuples resulting from evaluation of the fields XPath expression(s), with those of the referenced key.

IdentityConstraintCategory.UNIQUE

The xsd.IdentityConstraintDefinition asserts uniqueness, with respect to the content identified by selector, of the tuples resulting from evaluation of the fields XPath expression(s).

class xsd.ModelGroupCompositor

The xsd.ModelGroupCompositor enumeration provides values for the xsd.ModelGroup.compositor property.

ModelGroupCompositor.ALL

Specifies a conjunctive (all) interpretation of the xsd.Particle objects of a xsd.ModelGroup. The xml.ElementInformationItem children validated by such a xsd.ModelGroup must correspond to the specified xsd.Particles. The elements can occur in any order.

ModelGroupCompositor.CHOICE

Specifies a disjunctive (choice) interpretation of the xsd.Particle objects of a xsd.ModelGroup. The xml.ElementInformationItem children validated by such a xsd.ModelGroup must correspond to exactly one of the specified xsd.Particles.

ModelGroupCompositor.SEQUENCE

Specifies a sequential (sequence) interpretation of the xsd.Particle objects of a xsd.ModelGorup. The xml.ElementInformationItem children validated by such a xsd.ModelGroup must correspond, in order, to the specified xsd.Particles.

class xsd.NamespaceConstraintVariety

The xsd.NamespaceConstraintVariety enumeration provides values for the variety property of xsd.NamespaceConstraint property records.

NamespaceConstraintVariety.ANY

Permit xml.AttributeInformationItem/xml.ElementInformationItem objects with any namespace or which are not namespace-qualified.

NamespaceConstraintVariety.ENUMERATION

Permit xml.AttributeInformationItem/xml.ElementInformationItem objects with a namespace specified in the xsd.NamespaceConstraint.namespaces property of the xsd.NamespaceConstraint property record.

NamespaceConstraintVariety.NOT

Permit xml.AttributeInformationItem/xml.ElementInformationItem objects with a namespace not specified in the xsd.NamespaceConstraint.namespaces property of the xsd.NamespaceConstraint property record.

class xsd.OpenContentMode

The xsd.OpenContent enumeration provides values for the xsd.OpenContent.mode property.

OpenContentMode.INTERLEAVE

Allows xml.ElementInformationItem objects that match the wildcard (Any) of the OpenContent everywhere in the content.

OpenContentMode.SUFFIX

Allows xml.ElementInformationItem objects that match the wildcard (Any) of the OpenContent only at the end of the content.

class xsd.ProcessContents

The xsd.ProcessContents enumeration provides values for the xsd.Any.process_contents and xsd.AnyAttribute.process_contents properties of wildcard schema components.

ProcessContents.LAX

Validate the information item if a uniquely determined declaration is available, otherwise skip.

ProcessContents.SKIP

No constraints on the information item validated. It must simply be well-formed XML.

ProcessContents.STRICT

There must be a top-level declaration for the item available, or the item must have an xsi:type, and the item must be valid as appropriate.

class xsd.ScopeVariety

The xsd.ScopeVariety enumeration provides values for the xsd.Scope.variety property of xsd.Scope property records.

ScopeVariety.GLOBAL

Global declarations are available for use throughout the xsd.Schema.

ScopeVariety.LOCAL

Local declarations are only available within the parent.

class xsd.SimpleTypeVariety

The xsd.SimpleTypeVariety enumeration provides values for the xsd.SimpleTypeDefinition.variety property.

SimpleTypeVariety.ATOMIC

ATOMIC datatypes are those whose value spaces contain only atomic values.

SimpleTypeVariety.LIST

LIST datatypes are those having values each of which consists of a finite-length (possibly empty) sequence of atomic values.

SimpleTypeVariety.UNION

UNION datatypes are those whose value spaces are the union of the value spaces of one or more other datatypes, which are the member types of the union.

class xsd.ValueConstraintVariety

The xsd.ValueConstraintVariety enumeration provides values for the xsd.ValueConstraint.variety property of xsd.ValueConstraint property records.

ValueConstraintVariety.DEFAULT

If the xml.ElementInformationItem being validated is empty, or the xml.AttributeInformationItem is missing, then the the ValueConstraints is used to add an xml.AttributeInformationItem to the post-schema-validation infoset (in case of the ValueConstraint of an xsd.AttributeDeclaration) or to calculate post-schema-validation infoset contributions like the schema_actual_value for the empty xml.ElementInformationItem (in case of the ValueConstraint of an xsd.ElementDeclaration).

ValueConstraintVariety.FIXED

Like xsd.ValueConstraintVariety.DEFAULT, but if the xml.ElementInformationItem is not empty or the xml.AttributeInformationItem is not missing its xml.ElementInformationItem.schema_actual_value property must match the xsd.ValueConstraint.value property.

class xsd.WhiteSpace

The xsd.WhiteSpace enumeration provides values for the xsd.WhiteSpaceFacet.value property. The values describe the different forms of white space normalization.

WhiteSpace.COLLAPSE

After the processing implied by xsd.WhiteSpace.REPLACE, contiguous sequences of #x20’s are collapsed to a single #x20, and any #x20 at the start or end of the string is then removed.

WhiteSpace.PRESERVE

No normalization is done, the value is not changed (this is the behavior required by XML for element content).

WhiteSpace.REPLACE

All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return) are replaced with #x20 (space).

String Constants

xsd.NAMESPACE_XSD

http://www.w3.org/2001/XMLSchema

xsd.NAMESPACE_XSI

http://www.w3.org/2001/XMLSchema-instance