Contains the definition of a schema.
<schema attributeFormDefault = (qualified | unqualified): unqualified blockDefault = (#all | List of (extension | restriction | substitution) : '' elementFormDefault = (qualified | unqualified): unqualified finalDefault = (#all | List of (extension | restriction | list | union): '' id = ID targetNamespace = anyURI version = token xml:lang = language {any attributes with non-schema Namespace}…> Content: ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*) </schema>
If the value is unqualified, attributes from the target namespace are not required to be qualified with the namespace prefix.
If the value is qualified, attributes from the target namespace must be qualified with the namespace prefix.
This value is the global default for all attributes declared in the target namespace. Individual attributes can override this setting for their local scope using the form attribute.
Optional.
extension | Prevents complex types derived by extension from being used in place of this complex type. |
restriction | Prevents complex types derived by restriction from being used in place of this complex type. |
substitution | Prevents substitution of elements. (An element can declare itself a substitution for another element by specifying the name of the other element in its substitutionGroup attribute.) |
#all | Prevents all derived complex types from being used in place of this complex type. |
Optional.
If the value is unqualified, elements from the target namespace are not required to be qualified with the namespace prefix.
If the value is qualified, elements from the target namespace must be qualified with the namespace prefix.
This value is the global default for all elements declared in the target namespace. Individual elements can override this setting for their local scope using the form attribute.
Optional.
extension | By default, elements in this schema cannot be derived by extension. Applies to element and complexType elements only. |
restriction | Prevents derivation by restriction. |
list | Prevents derivation by list. Applies to simpleType elements only. |
union | Prevents derivation by union. Applies to simpleType elements only. |
#all | #all. By default, elements in this schema cannot be derived by any method. |
Optional.
Optional.
Optional.
Optional.
Optional.
Number of occurrences | One time |
Parent elements | (No parent elements) |
Content | include, import, annotation, redefine
attribute, attributeGroup, element, group, notation, simpleType, complexType |
Other | The include, import, and redefine elements must come before the other elements except for annotation element, which can appear anywhere. |
The schema element is the document element (the top-level element) in a schema definition.
The namespaces specified using the xmlns attribute must include the namespace for the schema-defining elements and attributes (schema, element, and so on). Any prefix can be used, but it is convenient to make the schema namespace the default namespace to avoid having to use a prefix on every XML Schema element.
The targetNamespace is the namespace of all schema components in this schema as well as any schemas included using the include element. (Included schemas must have the same target namespace as the containing schema or have no target namespace at all.) In the following example, the schema components (element name, type) in the http://www.w3.org/2001/XMLSchema namespace are unqualified and those for http://tempuri.org/myschema (mydecimal) are qualified with the msc prefix.
<xs:schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:msc=”http://tempuri.org/myschema” targetNamespace=”http://tempuri.org/myschema”> <xs:element name="Price" type="msc:mydecimal"/> </xs:schema>
For XML Schema, the namespace is the following:
http://www.w3.org/2001/XMLSchema
In addition, the schema element should also contain namespace declarations for any other schemas that it uses.
The following schema uses the XML Schema namespace as the default namespace and defines the target namespace for the schema as http://mynamespace/myschema
.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://mynamespace/myschema"> <!--Put schema content here --> </xs:schema>
XML Schema Reference (XSD) | XML Schema Elements | include
For more information, see the W3C XML Schema Part 1: Structures Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-schema.