XML Schema Elements
XML Schema elements are grouped by their function: top level elements, particles, multiple XML documents and namespaces, identity constraints, attributes, named attributes, complex type definitions, and simple type definitions.
Top Level Elements
Particles
Multiple XML Documents and Namespaces
Identity Constraints
Attributes
Named Schema Objects
Complex Type Definitions
Simple Type Definitions
Top Level Elements
The following are elements that appear at the top level of a schema document.
Element | Description |
---|---|
Defines an annotation. |
|
Declares an attribute. |
|
Groups a set of attribute declarations so that they can be incorporated as a group for complex type definitions. |
|
Defines a complex type, which determines the set of attributes and the content of an element. |
|
Declares an element. |
|
Groups a set of element declarations so that they can be incorporated as a group into complex type definitions. |
|
Identifies a namespace whose schema components are referenced by the containing schema. |
|
Includes the specified schema document in the target namespace of the containing schema. |
|
Contains the definition of a notation to describe the format of non-XML data within an XML document. An XML Schema notation declaration is a reconstruction of XML 1.0 NOTATION declarations. |
|
Allows simple and complex types, groups, and attribute groups that are obtained from external schema files to be redefined in the current schema. |
|
Defines a simple type, which determines the constraints on and information about the values of attributes or elements with text-only content. |
Particles
The following are elements that can have minOccurs and maxOccurs attributes. Such elements always appear as part of a complex type definition or as part of a named model group.
Element | Description |
---|---|
Allows the elements in the group to appear (or not appear) in any order in the containing element. |
|
Enables any element from the specified namespace(s) to appear in the containing sequence or choice element. |
|
Allows one and only one of the elements contained in the selected group to be present within the containing element. |
|
Declares an element. |
|
Groups a set of element declarations so that they can be incorporated as a group into complex type definitions. |
|
Requires the elements in the group to appear in the specified sequence within the containing element. |
Multiple XML Documents and Namespaces
The following are elements that bring in schema elements from other namespaces or redefine schema elements in the same namespace.
Element | Description |
---|---|
Identifies a namespace whose schema components are referenced by the containing schema. |
|
Includes the specified schema document in the target namespace of the containing schema. |
|
Allows simple and complex types, groups, and attribute groups that are obtained from external schema files to be redefined in the current schema. |
Identity Constraints
The following are elements that are related to identity constraints.
Element | Description |
---|---|
Specifies an XML Path Language (XPath) expression that specifies the value (or one of the values) used to define an identity constraint (unique, key, and keyref elements). |
|
Specifies that an attribute or element value (or set of values) must be a key within the specified scope. The scope of a key is the containing element in an instance document. A key must be unique, non-nillable, and always present. |
|
Specifies that an attribute or element value (or set of values) correspond to those of the specified key or unique element. |
|
Specifies an XPath expression that selects a set of elements for an identity constraint (unique, key, and keyref elements). |
|
Specifies that an attribute or element value (or a combination of attribute or element values) must be unique within the specified scope. The value must be unique or nil. |
Attributes
The following are elements that define attributes in schemas.
Element | Description |
---|---|
Enables any attribute from the specified namespace(s) to appear in the containing complexType element or in the containing attributeGroup element. |
|
Declares an attribute. |
|
Groups a set of attribute declarations so that they can be incorporated as a group for complex type definitions. |
Named Schema Objects
The following are elements that define named constructs in schemas. Named constructs are referred to with a QName by other schema elements.
Element | Description |
---|---|
Declares an attribute. |
|
Groups a set of attribute declarations so that they can be incorporated as a group for complex type definitions. |
|
Defines a complex type, which determines the set of attributes and the content of an element. |
|
Declares an element. |
|
Groups a set of element declarations so that they can be incorporated as a group into complex type definitions. |
|
Specifies that an attribute or element value (or set of values) must be a key within the specified scope. The scope of a key is the containing element in an instance document. A key must be unique, non-nillable, and always present. |
|
Specifies that an attribute or element value (or set of values) correspond to those of the specified key or unique element. |
|
Contains the definition of a notation to describe the format of non-XML data within an XML document. An XML Schema notation declaration is a reconstruction of XML 1.0 NOTATION declarations. |
|
Defines a simple type, which determines the constraints on and information about the values of attributes or elements with text-only content. |
|
Specifies that an attribute or element value (or a combination of attribute or element values) must be unique within the specified scope. The value must be unique or nil. |
Complex Type Definitions
The following are elements that create complex type definitions.
Element | Description |
---|---|
Allows the elements in the group to appear (or not appear) in any order in the containing element. |
|
Defines an annotation. |
|
Enables any element from the specified namespace(s) to appear in the containing sequence or choice element. |
|
Enables any attribute from the specified namespace(s) to appear in the containing complexType element or in the containing attributeGroup element. |
|
Specifies information to be used by applications within an annotation element. |
|
Declares an attribute. |
|
Groups a set of attribute declarations so that they can be incorporated as a group for complex type definitions. |
|
Allows one and only one of the elements contained in the selected group to be present within the containing element. |
|
Contains extensions or restrictions on a complex type that contains mixed content or elements only. |
|
Specifies information to be read or used by users within an annotation element. |
|
Declares an element. |
|
Contains extensions on simpleContent. This extends a simple type or a complex type that has simple content by adding specified attribute(s), attribute groups(s) or anyAttribute. |
|
Contains extensions on complexContent. |
|
Groups a set of element declarations so that they can be incorporated as a group into complex type definitions. |
|
Defines constraints on a simpleContent definition. |
|
Defines constraints on a complexContent definition. |
|
Requires the elements in the group to appear in the specified sequence within the containing element. |
|
Contains extensions or restrictions on a complexType element with character data or a simpleType element as content and contains no elements. |
Simple Type Definitions
The following are elements that create simple type definitions.
Element | Description |
---|---|
Defines an annotation. |
|
Specifies information to be used by applications within an annotation element. |
|
Specifies information to be read or used by users within an annotation element. |
|
Declares an element. |
|
Defines a collection of a single simpleType definition. |
|
Defines constraints on a simpleType definition |
|
Defines a collection of multiple simpleType definitions. |
See Also
Reference
XML Schemas (XSD) Reference
XML Data Types Reference
Primitive XML Data Types
Derived XML Data Types