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.Annotationxsd.Anyxsd.AnyAttributexsd.Assertionxsd.AssertionsFacetxsd.AtomicValueFacetxsd.AttributeDeclarationxsd.AttributeGroupDefinitionxsd.AttributeUsexsd.ComplexTypeDefinitionxsd.Componentxsd.ContentTypexsd.Definedxsd.ENTITYxsd.ElementDeclarationxsd.EnumerationFacetxsd.ExplicitTimezoneFacetxsd.Facetxsd.FractionDigitsFacetxsd.IDxsd.IDREFxsd.ID_IDREF_Bindingxsd.ID_IDREF_Tablexsd.IdentityConstraintDefinitionxsd.Importxsd.Includexsd.LengthFacetxsd.MaxExclusiveFacetxsd.MaxInclusiveFacetxsd.MaxLengthFacetxsd.MinExclusiveFacetxsd.MinInclusiveFacetxsd.MinLengthFacetxsd.ModelGroupxsd.ModelGroupDefinitionxsd.NCNamexsd.NMTOKENxsd.NOTATIONxsd.Namexsd.NamespaceBindingxsd.NamespaceConstraintxsd.NotationDeclarationxsd.OpenContentxsd.Overridexsd.Particlexsd.PatternFacetxsd.QNamexsd.Redefinexsd.Schemaxsd.SchemaDocumentxsd.SchemaElementxsd.Scopexsd.Siblingxsd.SimpleTypeDefinitionxsd.TotalDigitsFacetxsd.TypeAlternativexsd.TypeDefinitionxsd.TypeTablexsd.Unboundedxsd.ValueConstraintxsd.WhiteSpaceFacetxsd.XPathExpressionxsd.anyAtomicTypexsd.anySimpleTypexsd.anyURIxsd.base64Binaryxsd.booleanxsd.bytexsd.datexsd.dateTimexsd.dateTimeStampxsd.dayTimeDurationxsd.decimalxsd.doublexsd.durationxsd.floatxsd.gDayxsd.gMonthxsd.gMonthDayxsd.gYearxsd.gYearMonthxsd.hexBinaryxsd.intxsd.integerxsd.languagexsd.listxsd.longxsd.negativeIntegerxsd.nonNegativeIntegerxsd.nonPositiveIntegerxsd.normalizedStringxsd.positiveIntegerxsd.shortxsd.stringxsd.timexsd.tokenxsd.unsignedBytexsd.unsignedIntxsd.unsignedLongxsd.unsignedShortxsd.yearMonthDuration
Enum Classes¶
-
class
xsd.BlockValue¶ The
xsd.BlockValueenumeration provides values for thexsd.ElementDeclaration.disallowed_substitutionsproperty as well as for thexsd.ComplexTypeDefinition.prohibited_substitutionsproperty.
-
BlockValue.EXTENSION¶ Disallow substitution with
xsd.ComplexTypeDefinitionobjects derived by extension.
-
BlockValue.RESTRICTION¶ Disallow substitution with
xsd.ComplexTypeDefinitionobjects derived by restriction.
-
BlockValue.SUBSTITUTION¶ Disallow substitution with potential substitution group members.
-
class
xsd.ContentTypeVariety¶ The
xsd.ContentTypeVarietyenumeration provides values for thexsd.ContentType.varietyproperty of thexsd.ContentTypeproperty record.
-
ContentTypeVariety.ELEMENT_ONLY¶ A
xsd.ContentTypewith this variety validates elements with children that conform to the content model supplied by itsxsd.Particle.
-
ContentTypeVariety.EMPTY¶ A
xsd.ContentTypewith this variety validates elements with noxml.CharDataInformationItemorxml.ElementInformationItemchildren.
-
ContentTypeVariety.MIXED¶ A
xsd.ContentTypewith this variety validates elements whosexml.ElementInformationItemchildren (i.e. specifically ignoring other children such asxml.CharDataInformationItemobjects) conform to the content model supplied by itsxsd.Particle.
-
ContentTypeVariety.SIMPLE¶ A
xsd.ContentTypewith this variety validates elements with character-only children using itsxsd.SimpleTypeDefinition.
-
class
xsd.DerivationMethod¶ The
xsd.DerivationMethodenumeration provides values for thexsd.ComplexTypeDefinition.derivation_methodproperty.
-
DerivationMethod.EXTENSION¶ For
xsd.ComplexTypeDefinitionobjects that are derived by extension.
-
DerivationMethod.RESTRICTION¶ For
xsd.ComplexTypeDefinitionobjects that are derived by restriction.
-
class
xsd.ExplicitTimezone¶ The
xsd.ExplicitTimezoneenumeration provides values for thexsd.ExplicitTimezoneFacet.valueproperty.
-
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.FinalValueenumeration provides values for the substitution_group_exclusions property ofxsd.ElementDeclarationobjects as well as for thexsd.ComplexTypeDefinition.finalandxsd.SimpleTypeDefinition.finalproperties.
-
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.IdentityConstraintCategoryenumeration provides values for thexsd.IdentityConstraintDefinition.identity_constraint_categoryproperty.
-
IdentityConstraintCategory.KEY¶ The
xsd.IdentityConstraintDefinitionasserts uniqueness as for UNIQUE. KEY further asserts that all selected content actually has such tuples.
-
IdentityConstraintCategory.KEYREF¶ The
xsd.IdentityConstraintDefinitionasserts 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.IdentityConstraintDefinitionasserts 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.ModelGroupCompositorenumeration provides values for thexsd.ModelGroup.compositorproperty.
-
ModelGroupCompositor.ALL¶ Specifies a conjunctive (all) interpretation of the
xsd.Particleobjects of axsd.ModelGroup. Thexml.ElementInformationItemchildren validated by such axsd.ModelGroupmust correspond to the specified xsd.Particles. The elements can occur in any order.
-
ModelGroupCompositor.CHOICE¶ Specifies a disjunctive (choice) interpretation of the
xsd.Particleobjects of axsd.ModelGroup. Thexml.ElementInformationItemchildren validated by such axsd.ModelGroupmust correspond to exactly one of the specified xsd.Particles.
-
ModelGroupCompositor.SEQUENCE¶ Specifies a sequential (sequence) interpretation of the
xsd.Particleobjects of a xsd.ModelGorup. Thexml.ElementInformationItemchildren validated by such axsd.ModelGroupmust correspond, in order, to the specified xsd.Particles.
-
class
xsd.NamespaceConstraintVariety¶ The
xsd.NamespaceConstraintVarietyenumeration provides values for the variety property ofxsd.NamespaceConstraintproperty records.
-
NamespaceConstraintVariety.ANY¶ Permit
xml.AttributeInformationItem/xml.ElementInformationItemobjects with any namespace or which are not namespace-qualified.
-
NamespaceConstraintVariety.ENUMERATION¶ Permit
xml.AttributeInformationItem/xml.ElementInformationItemobjects with a namespace specified in thexsd.NamespaceConstraint.namespacesproperty of thexsd.NamespaceConstraintproperty record.
-
NamespaceConstraintVariety.NOT¶ Permit
xml.AttributeInformationItem/xml.ElementInformationItemobjects with a namespace not specified in thexsd.NamespaceConstraint.namespacesproperty of thexsd.NamespaceConstraintproperty record.
-
class
xsd.OpenContentMode¶ The
xsd.OpenContentenumeration provides values for thexsd.OpenContent.modeproperty.
-
OpenContentMode.INTERLEAVE¶ Allows
xml.ElementInformationItemobjects that match the wildcard (Any) of the OpenContent everywhere in the content.
-
OpenContentMode.SUFFIX¶ Allows
xml.ElementInformationItemobjects that match the wildcard (Any) of the OpenContent only at the end of the content.
-
class
xsd.ProcessContents¶ The
xsd.ProcessContentsenumeration provides values for thexsd.Any.process_contentsandxsd.AnyAttribute.process_contentsproperties 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.ScopeVarietyenumeration provides values for thexsd.Scope.varietyproperty ofxsd.Scopeproperty 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.SimpleTypeVarietyenumeration provides values for thexsd.SimpleTypeDefinition.varietyproperty.
-
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.ValueConstraintVarietyenumeration provides values for thexsd.ValueConstraint.varietyproperty ofxsd.ValueConstraintproperty records.
-
ValueConstraintVariety.DEFAULT¶ If the
xml.ElementInformationItembeing validated is empty, or thexml.AttributeInformationItemis missing, then the the ValueConstraints is used to add anxml.AttributeInformationItemto 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.ElementInformationItemis not empty or thexml.AttributeInformationItemis not missing itsxml.ElementInformationItem.schema_actual_valueproperty must match thexsd.ValueConstraint.valueproperty.
-
class
xsd.WhiteSpace¶ The
xsd.WhiteSpaceenumeration provides values for thexsd.WhiteSpaceFacet.valueproperty. 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).