XML technologies / XML Schema / XML Schema element reference / xs:schema

(Excerpt from “XML Schema” by Eric van der Vlist)

Document element of a W3C XML Schema.

<xs:schema
    attributeFormDefault = ( "qualified" | "unqualified" ) : "unqualified"
    blockDefault = ( "#all" | list of ( "extension" | "restriction" | "substitution" ) ) : ""
    elementFormDefault = ( "qualified" | "unqualified" ) : "unqualified"
    finalDefault = ( "#all" | list of ( "extension" | "restriction" ) ) : ""
    id = xs:ID
    targetNamespace = xs:anyURI
    version = xs:token
    xml:lang = xml:lang
    {beliebige Attribute mit einem Nicht-Schema-Namensraum}
    >
    Content: ((xs:include | xs:import | xs:redefine | xs:annotation)*, (, ( | (xs:simpleType | xs:complexType | xs:group | xs:attributeGroup) | xs:element | xs:attribute | xs:notation), xs:annotation*)*)
</xs:schema>

May occur within: must be the root element

Description

xs:schema is the document or root element of every W3C XML Schema. It contains all schema declarations and definitions and holds defaults expressed as attributes. Compositors embedded directly under xs:schema have a special role as global definitions that can be referenced elsewhere.

Restrictions

An xs:schema element, hence a schema, is associated with at most one namespace and must import compositor definitions for other namespaces as needed.

Example

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="name" type="xs:string"/>
    <xs:element name="qualification" type="xs:string"/>
    <xs:element name="born" type="xs:date"/>
    <xs:element name="dead" type="xs:date"/>
    <xs:element name="isbn" type="xs:NMTOKEN"/>
    <xs:attribute name="id" type="xs:ID"/>
    <xs:attribute name="available" type="xs:boolean"/>
    <xs:attribute name="lang" type="xs:language"/>
    .../...
</xs:schema>

Attributes

attributeFormDefault
Default for the form attributes of xs:attribute; determines whether attributes are namespace-qualified by default.

blockDefault
Default for the block attribute of xs:element and xs:complexType.

elementFormDefault
Default for the form attributes of xs:element; determines whether elements are namespace-qualified by default.

finalDefault
Default for the final attribute of xs:element and xs:complexType.

id
Element ID according to W3C XML Schema.

targetNamespace
The namespace associated with this schema. All qualified elements and attributes defined here belong to it, and all global components are associated with it.

version
Schema version, for user purposes.

xml
Schema language.

   

 

 

 

back to top