XML Schema Elements

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XML Schemas

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
annotation Defines an annotation.
attribute Declares an attribute.
attributeGroup Groups a set of attribute declarations so that they can be incorporated as a group for complex type definitions.
complexType Defines a complex type, which determines the set of attributes and the content of an element.
element Declares an element.
group Groups a set of element declarations so that they can be incorporated as a group into complex type definitions.
import Identifies a namespace whose schema components are referenced by the containing schema.
include Includes the specified schema document in the target namespace of the containing schema.
notation 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.
redefine Allows simple and complex types, groups, and attribute groups that are obtained from external schema files to be redefined in the current schema.
simpleType 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
all Allows the elements in the group to appear (or not appear) in any order in the containing element.
any Enables any element from the specified namespace(s) to appear in the containing sequence or choice element.
choice Allows one and only one of the elements contained in the selected group to be present within the containing element.
element Declares an element.
group Groups a set of element declarations so that they can be incorporated as a group into complex type definitions.
sequence 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
import Identifies a namespace whose schema components are referenced by the containing schema.
include Includes the specified schema document in the target namespace of the containing schema.
redefine 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
field 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).
key 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.
keyref Specifies that an attribute or element value (or set of values) correspond to those of the specified key or unique element.
selector Specifies an XPath expression that selects a set of elements for an identity constraint (unique, key, and keyref elements).
unique 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
anyAttribute Enables any attribute from the specified namespace(s) to appear in the containing complexType element or in the containing attributeGroup element.
attribute Declares an attribute.
attributeGroup 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
attribute Declares an attribute.
attributeGroup Groups a set of attribute declarations so that they can be incorporated as a group for complex type definitions.
complexType Defines a complex type, which determines the set of attributes and the content of an element.
element Declares an element.
group Groups a set of element declarations so that they can be incorporated as a group into complex type definitions.
key 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.
keyref Specifies that an attribute or element value (or set of values) correspond to those of the specified key or unique element.
notation 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.
simpleType Defines a simple type, which determines the constraints on and information about the values of attributes or elements with text-only content.
unique 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
all Allows the elements in the group to appear (or not appear) in any order in the containing element.
annotation Defines an annotation.
any Enables any element from the specified namespace(s) to appear in the containing sequence or choice element.
anyAttribute Enables any attribute from the specified namespace(s) to appear in the containing complexType element or in the containing attributeGroup element.
appinfo Specifies information to be used by applications within an annotation element.
attribute Declares an attribute.
attributeGroup Groups a set of attribute declarations so that they can be incorporated as a group for complex type definitions.
choice Allows one and only one of the elements contained in the selected group to be present within the containing element.
complexContent Contains extensions or restrictions on a complex type that contains mixed content or elements only.
documentation Specifies information to be read or used by users within an annotation element.
element Declares an element.
extension (simpleContent) 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.
extension (complexContent) Contains extensions on complexContent.
group Groups a set of element declarations so that they can be incorporated as a group into complex type definitions.
restriction (simpleContent) Defines constraints on a simpleContent definition.
restriction (complexContent) Defines constraints on a complexContent definition.
sequence Requires the elements in the group to appear in the specified sequence within the containing element.
simpleContent 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
annotation Defines an annotation.
appinfo Specifies information to be used by applications within an annotation element.
documentation Specifies information to be read or used by users within an annotation element.
element Declares an element.
list Defines a collection of a single simpleType definition.
restriction (simpleType) Defines constraints on a simpleType definition
union Defines a collection of multiple simpleType definitions.

See Also

XML Schema Element Map | XML Schema Reference (XSD) | XML Data Types Reference | Primitive XML Data Types | Derived XML Data Types | Data Type Facets