XML Schema Documentation

Table of Contents

top

Schema Document Properties

Target Namespace None
Element and Attribute Namespaces
  • Global element and attribute declarations belong to this schema's target namespace.
  • By default, local element declarations have no namespace.
  • By default, local attribute declarations have no namespace.
Documentation Purchase order schema for Example.com. Copyright 2000 Example.com. All rights reserved.

Declared Namespaces

Prefix Namespace
xml http://www.w3.org/XML/1998/namespace
xsd http://www.w3.org/2001/XMLSchema
Schema Component Representation
<xsd:schema>
...
</xsd:schema>
top

Global Declarations

Element: comment

Name comment
Type xsd:string
Nillable no
Abstract no
Diagram
XML Instance Representation
<comment> xsd:string </comment>
Schema Component Representation
<xsd:element name="comment" type="xsd:string"/>
top

Element: Note

Name Note
Type anyType
Nillable no
Abstract no
Diagram
XML Instance Representation
<Note> ... </Note>
Schema Component Representation
<xsd:element name="Note"/>
top

Element: purchaseOrder

  • This element can be used wherever the following element is referenced:
  • The following elements can be used wherever this element is referenced:
Name purchaseOrder
Type PurchaseOrderType
Nillable no
Abstract no
Diagram
XML Instance Representation
<purchaseOrder
orderDate="xsd:date [0..1]">
<shipTo> USAddress </shipTo> [1]
<billTo> USAddress </billTo> [1]
<comment> ... </comment> [0..1]
<items> Items </items> [1]
</purchaseOrder>
Schema Component Representation
<xsd:element name="purchaseOrder" type="PurchaseOrderType" substitutionGroup="purchaseOrder"/>
top

Global Definitions

Complex Type: Items

Super-types: None
Sub-types: None
Name Items
Abstract no
Diagram
XML Instance Representation
<...>
<item
partNum="SKU [0..1]"> [0..*]
<productName> xsd:string </productName> [1]
<quantity> xsd:positiveInteger (value < 100) </quantity> [1]
<USPrice> xsd:decimal </USPrice> [1]
<comment> ... </comment> [0..1]
<shipDate> xsd:date </shipDate> [0..1]
</item>
</...>
Schema Component Representation
<xsd:complexType name="Items">
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="productName" type="xsd:string"/>
<xsd:element name="quantity">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="USPrice" type="xsd:decimal"/>
<xsd:element ref="comment" minOccurs="0"/>
<xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="partNum" type="SKU"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
top

Complex Type: Product

Super-types: None
Sub-types: None
Name Product
Abstract no
Diagram
XML Instance Representation
<...
p_id="anySimpleType [0..1]">
<Name> ... </Name> [1]
<Description> ... </Description> [1]
<Manufacturer> ... </Manufacturer> [1]
</...>
Schema Component Representation
<xsd:complexType name="Product">
<xsd:attribute name="p_id"/>
<xsd:sequence>
<xsd:element name="Name"/>
<xsd:element name="Description"/>
<xsd:element name="Manufacturer"/>
</xsd:sequence>
</xsd:complexType>
top

Complex Type: PurchaseOrderType

Super-types: None
Sub-types: None
Name PurchaseOrderType
Abstract no
Diagram
XML Instance Representation
<...
orderDate="xsd:date [0..1]">
<shipTo> USAddress </shipTo> [1]
<billTo> USAddress </billTo> [1]
<comment> ... </comment> [0..1]
<items> Items </items> [1]
</...>
Schema Component Representation
<xsd:complexType name="PurchaseOrderType">
<xsd:sequence>
<xsd:element name="shipTo" type="USAddress"/>
<xsd:element name="billTo" type="USAddress"/>
<xsd:element ref="comment" minOccurs="0"/>
<xsd:element name="items" type="Items"/>
</xsd:sequence>
<xsd:attribute name="orderDate" type="xsd:date"/>
</xsd:complexType>
top

Complex Type: USAddress

Super-types: None
Sub-types: None
Name USAddress
Abstract no
Diagram
XML Instance Representation
<...
country="US [0..1]">
<name> xsd:string </name> [1]
<street> xsd:string </street> [1]
<city> xsd:string </city> [1]
<state> xsd:string </state> [1]
<zip> xsd:decimal </zip> [1]
<abc> [1]
<abc> [1]
<avb> [1]
<abc> ... </abc> [1]
</avb>
</abc>
</abc>
</...>
Schema Component Representation
<xsd:complexType name="USAddress">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="city" type="xsd:string"/>
<xsd:element name="state" type="xsd:string"/>
<xsd:element name="zip" type="xsd:decimal"/>
<xsd:sequence>
<xsd:element name="abc">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="abc">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="avb">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="abc"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:sequence>
<xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
</xsd:complexType>
top

Simple Type: SKU

Super-types: xsd:string < SKU (by restriction)
Sub-types: None
Name SKU
Content
  • Base XSD Type: string
  • pattern = \d{3}-[A-Z]{2}
Diagram
Schema Component Representation
<xsd:simpleType name="SKU">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{3}-[A-Z]{2}"/>
</xsd:restriction>
</xsd:simpleType>
top

Legend

Complex Type:

Schema Component Type

AusAddress

Schema Component Name
Super-types: Address < AusAddress (by extension)
Sub-types:
  • QLDAddress (by restriction)
If this schema component is a type definition, its type hierarchy is shown in a gray-bordered box.
Name AusAddress
Abstract no
The table above displays the properties of this schema component.
XML Instance Representation
<... country="Australia" >
<unitNo> string </unitNo> [0..1]
<houseNo> string </houseNo> [1]
<street> string </street> [1]
Start Choice [1]
<city> string </city> [1]
<town> string </town> [1]
End Choice
<state> AusStates </state> [1]
<postcode> string <<pattern = [1-9][0-9]{3}>> </postcode> [1] ?
</...>

The XML Instance Representation table above shows the schema component's content as an XML instance.

Schema Component Representation
<complexType name="AusAddress">
<complexContent>
<extension base="Address">
<sequence>
<element name="state" type="AusStates"/>
<element name="postcode">
<simpleType>
<restriction base="string">
<pattern value="[1-9][0-9]{3}"/>
</restriction>
</simpleType>
</element>
</sequence>
<attribute name="country" type="string" fixed="Australia"/>
</extension>
</complexContent>
</complexType>
The Schema Component Representation table above displays the underlying XML representation of the schema component. (Annotations are not shown.)
top

Glossary

Abstract (Applies to complex type definitions and element declarations). An abstract element or complex type cannot used to validate an element instance. If there is a reference to an abstract element, only element declarations that can substitute the abstract element can be used to validate the instance. For references to abstract type definitions, only derived types can be used.

All Model Group Child elements can be provided in any order in instances. See: http://www.w3.org/TR/xmlschema-1/#element-all.

Choice Model Group Only one from the list of child elements and model groups can be provided in instances. See: http://www.w3.org/TR/xmlschema-1/#element-choice.

Collapse Whitespace Policy Replace tab, line feed, and carriage return characters with space character (Unicode character 32). Then, collapse contiguous sequences of space characters into single space character, and remove leading and trailing space characters.

Disallowed Substitutions (Applies to element declarations). If substitution is specified, then substitution group members cannot be used in place of the given element declaration to validate element instances. If derivation methods, e.g. extension, restriction, are specified, then the given element declaration will not validate element instances that have types derived from the element declaration's type using the specified derivation methods. Normally, element instances can override their declaration's type by specifying an xsi:type attribute.

Key Constraint Like Uniqueness Constraint, but additionally requires that the specified value(s) must be provided. See: http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions.

Key Reference Constraint Ensures that the specified value(s) must match value(s) from a Key Constraint or Uniqueness Constraint. See: http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions.

Model Group Groups together element content, specifying the order in which the element content can occur and the number of times the group of element content may be repeated. See: http://www.w3.org/TR/xmlschema-1/#Model_Groups.

Nillable (Applies to element declarations). If an element declaration is nillable, instances can use the xsi:nil attribute. The xsi:nil attribute is the boolean attribute, nil, from the http://www.w3.org/2001/XMLSchema-instance namespace. If an element instance has an xsi:nil attribute set to true, it can be left empty, even though its element declaration may have required content.

Notation A notation is used to identify the format of a piece of data. Values of elements and attributes that are of type, NOTATION, must come from the names of declared notations. See: http://www.w3.org/TR/xmlschema-1/#cNotation_Declarations.

Preserve Whitespace Policy Preserve whitespaces exactly as they appear in instances.

Prohibited Derivations (Applies to type definitions). Derivation methods that cannot be used to create sub-types from a given type definition.

Prohibited Substitutions (Applies to complex type definitions). Prevents sub-types that have been derived using the specified derivation methods from validating element instances in place of the given type definition.

Replace Whitespace Policy Replace tab, line feed, and carriage return characters with space character (Unicode character 32).

Sequence Model Group Child elements and model groups must be provided in the specified order in instances. See: http://www.w3.org/TR/xmlschema-1/#element-sequence.

Substitution Group Elements that are members of a substitution group can be used wherever the head element of the substitution group is referenced.

Substitution Group Exclusions (Applies to element declarations). Prohibits element declarations from nominating themselves as being able to substitute a given element declaration, if they have types that are derived from the original element's type using the specified derivation methods.

Target Namespace The target namespace identifies the namespace that components in this schema belongs to. If no target namespace is provided, then the schema components do not belong to any namespace.

Uniqueness Constraint Ensures uniqueness of an element/attribute value, or a combination of values, within a specified scope. See: http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions.

top