XML SchemaElement
Complete XML Schema Reference
Definition and Usage
The schema element defines the root element of a schema.
Element Information
- Parent Element:(None)
Syntax
id=ID
attributeFormDefault=qualified|unqualified
elementFormDefault=qualified|unqualified
blockDefault=(#all|list of (extension|restriction|substitution))
finalDefault=(#all|list of (extension|restriction|list|union))
targetNamespace=anyURI
version=token
xmlns=anyURI
any attributes
>
((include|import|redefine|annotation)*,(((simpleType|complexType|
group|attributeGroup)|element|attribute|notation),annotation*)*)
</schema>
| Attributes | Description |
|---|---|
| id | Optional. Specifies a unique ID for the element. |
| attributeFormDefault |
Optional. The form of attributes declared in the target namespace of the schema. The value must be one of the following strings: "qualified" or "unqualified". Default is "unqualified".
|
| elementFormDefault | Optional. The form of elements declared in the target namespace of the schema. The value must be one of the following strings: "qualified" or "unqualified". Default is "unqualified".
|
| blockDefault | Optional. Specifies the default value for the block attribute on element and complexType elements in the target namespace. The block attribute prevents complex types (or elements) with a specified derivation type from being used in place of the inherited complex type (or element). The value may contain #all or a list that is a subset of extension, restriction, or substitution:
|
| finalDefault | Optional. Specifies the default value for the final attribute on element, simpleType, and complexType elements in the target namespace of the schema. The final attribute prevents the specified derivation type for element, simpleType, or complexType elements. For element and complexType elements, the value may contain #all or a list that is a subset of extension or restriction. For simpleType elements, the value may also contain list and union:
|
| targetNamespace |
A URI reference for the namespace of the schema. A prefix can also be assigned to the namespace. If no prefix is assigned, the schema components of this namespace can be used with unqualified references. |
| version |
Optional. Specifies the version of the schema. |
| xmlns | Specifies one or more URI references for namespaces used in this schema. If no prefix is assigned, the schema components of this namespace can be used with unqualified references. |
| any attributes | Optional. Specifies any other attributes with non-schema namespaces. |
Example 1
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="values" type="xs:string">
</xs:schema>
Example 2
In this example, the schema components (element name, type) in the http://www.w3.org/2001/XMLSchema namespace are unqualified, while http://www.w3school.com.cn/w3schoolschema (mystring) is qualified by the wsc prefix:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:wsc="http://www.w3cschool.cc/w3shoolsschema">
<element name="fname" type="wsc:mystring"/>
</schema>
Complete XML Schema Reference Other Extensions