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¶
xsd.Annotation
xsd.Any
xsd.AnyAttribute
xsd.Assertion
xsd.AssertionsFacet
xsd.AtomicValueFacet
xsd.AttributeDeclaration
xsd.AttributeGroupDefinition
xsd.AttributeUse
xsd.ComplexTypeDefinition
xsd.Component
xsd.ContentType
xsd.Defined
xsd.ENTITY
xsd.ElementDeclaration
xsd.EnumerationFacet
xsd.ExplicitTimezoneFacet
xsd.Facet
xsd.FractionDigitsFacet
xsd.ID
xsd.IDREF
xsd.ID_IDREF_Binding
xsd.ID_IDREF_Table
xsd.IdentityConstraintDefinition
xsd.Import
xsd.Include
xsd.LengthFacet
xsd.MaxExclusiveFacet
xsd.MaxInclusiveFacet
xsd.MaxLengthFacet
xsd.MinExclusiveFacet
xsd.MinInclusiveFacet
xsd.MinLengthFacet
xsd.ModelGroup
xsd.ModelGroupDefinition
xsd.NCName
xsd.NMTOKEN
xsd.NOTATION
xsd.Name
xsd.NamespaceBinding
xsd.NamespaceConstraint
xsd.NotationDeclaration
xsd.OpenContent
xsd.Override
xsd.Particle
xsd.PatternFacet
xsd.QName
xsd.Redefine
xsd.Schema
xsd.SchemaDocument
xsd.SchemaElement
xsd.Scope
xsd.Sibling
xsd.SimpleTypeDefinition
xsd.TotalDigitsFacet
xsd.TypeAlternative
xsd.TypeDefinition
xsd.TypeTable
xsd.Unbounded
xsd.ValueConstraint
xsd.WhiteSpaceFacet
xsd.XPathExpression
xsd.anyAtomicType
xsd.anySimpleType
xsd.anyURI
xsd.base64Binary
xsd.boolean
xsd.byte
xsd.date
xsd.dateTime
xsd.dateTimeStamp
xsd.dayTimeDuration
xsd.decimal
xsd.double
xsd.duration
xsd.float
xsd.gDay
xsd.gMonth
xsd.gMonthDay
xsd.gYear
xsd.gYearMonth
xsd.hexBinary
xsd.int
xsd.integer
xsd.language
xsd.list
xsd.long
xsd.negativeInteger
xsd.nonNegativeInteger
xsd.nonPositiveInteger
xsd.normalizedString
xsd.positiveInteger
xsd.short
xsd.string
xsd.time
xsd.token
xsd.unsignedByte
xsd.unsignedInt
xsd.unsignedLong
xsd.unsignedShort
xsd.yearMonthDuration
Enum Classes¶
-
class
xsd.
BlockValue
¶ The
xsd.BlockValue
enumeration provides values for thexsd.ElementDeclaration.disallowed_substitutions
property as well as for thexsd.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 thexsd.ContentType.variety
property of thexsd.ContentType
property record.
-
ContentTypeVariety.
ELEMENT_ONLY
¶ A
xsd.ContentType
with this variety validates elements with children that conform to the content model supplied by itsxsd.Particle
.
-
ContentTypeVariety.
EMPTY
¶ A
xsd.ContentType
with this variety validates elements with noxml.CharDataInformationItem
orxml.ElementInformationItem
children.
-
ContentTypeVariety.
MIXED
¶ A
xsd.ContentType
with this variety validates elements whosexml.ElementInformationItem
children (i.e. specifically ignoring other children such asxml.CharDataInformationItem
objects) conform to the content model supplied by itsxsd.Particle
.
-
ContentTypeVariety.
SIMPLE
¶ A
xsd.ContentType
with this variety validates elements with character-only children using itsxsd.SimpleTypeDefinition
.
-
class
xsd.
DerivationMethod
¶ The
xsd.DerivationMethod
enumeration provides values for thexsd.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 thexsd.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 ofxsd.ElementDeclaration
objects as well as for thexsd.ComplexTypeDefinition.final
andxsd.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 thexsd.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 thexsd.ModelGroup.compositor
property.
-
ModelGroupCompositor.
ALL
¶ Specifies a conjunctive (all) interpretation of the
xsd.Particle
objects of axsd.ModelGroup
. Thexml.ElementInformationItem
children validated by such axsd.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 axsd.ModelGroup
. Thexml.ElementInformationItem
children validated by such axsd.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. Thexml.ElementInformationItem
children validated by such axsd.ModelGroup
must correspond, in order, to the specified xsd.Particles.
-
class
xsd.
NamespaceConstraintVariety
¶ The
xsd.NamespaceConstraintVariety
enumeration provides values for the variety property ofxsd.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 thexsd.NamespaceConstraint.namespaces
property of thexsd.NamespaceConstraint
property record.
-
NamespaceConstraintVariety.
NOT
¶ Permit
xml.AttributeInformationItem
/xml.ElementInformationItem
objects with a namespace not specified in thexsd.NamespaceConstraint.namespaces
property of thexsd.NamespaceConstraint
property record.
-
class
xsd.
OpenContentMode
¶ The
xsd.OpenContent
enumeration provides values for thexsd.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 thexsd.Any.process_contents
andxsd.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 thexsd.Scope.variety
property ofxsd.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 thexsd.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 thexsd.ValueConstraint.variety
property ofxsd.ValueConstraint
property records.
-
ValueConstraintVariety.
DEFAULT
¶ If the
xml.ElementInformationItem
being validated is empty, or thexml.AttributeInformationItem
is missing, then the the ValueConstraints is used to add anxml.AttributeInformationItem
to the post-schema-validation infoset (in case of the ValueConstraint of anxsd.AttributeDeclaration
) or to calculate post-schema-validation infoset contributions like the schema_actual_value for the emptyxml.ElementInformationItem
(in case of the ValueConstraint of anxsd.ElementDeclaration
).
-
ValueConstraintVariety.
FIXED
¶ Like
xsd.ValueConstraintVariety.DEFAULT
, but if thexml.ElementInformationItem
is not empty or thexml.AttributeInformationItem
is not missing itsxml.ElementInformationItem.schema_actual_value
property must match thexsd.ValueConstraint.value
property.
-
class
xsd.
WhiteSpace
¶ The
xsd.WhiteSpace
enumeration provides values for thexsd.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).