Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML schema Element

XML Schema Elements


XML Schema Reference Manual Complete XML Schema Reference Manual


Definition and Usage

The schema element defines the root element of a schema.

Element Information

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*)*)

property Description
id Optional. Specifies a unique ID for the element.
attributeFormDefault

Optional. The form of attributes declared in the target namespace of this schema. The value must be one of the following strings: "qualified" or "unqualified". The default is "unqualified".

  • "unqualified" indicates that attributes of the target namespace need not be qualified by a namespace prefix.
  • "qualified" indicates that attributes of the target namespace must be qualified by a namespace prefix.
  • | | elementFormDefault |

    Optional. The form of elements declared in the target namespace of this schema. The value must be one of the following strings: "qualified" or "unqualified". The default is "unqualified".

    | | blockDefault |

    Optional. Specifies the default value of the block attribute on element and complexType elements in the target namespace. The block attribute prevents complex types (or elements) with the specified derivation from being used in place of the inherited complex type (or element). The value can contain #all or a list that is a subset of extension, restriction, or substitution:

    | | finalDefault |

    Optional. Specifies the default value of the final attribute on element, simpleType, and complexType elements in the target namespace of the schema. The final attribute prevents the specified derivation of element, simpleType, or complexType elements. For element and complexType elements, the value can contain #all or a list that is a subset of extension or restriction. For simpleType elements, the value can also contain list and union:

    | | targetNamespace |

    A URI reference to the namespace of the schema. A prefix for the namespace can also be assigned. If no prefix is assigned, the schema components of that namespace can be used with unqualified references.

    | | version |

    Optional. Specifies the version of the schema.

    | | xmlns |

    Specifies URI references of one or more namespaces used in this schema. If no prefix is assigned, the schema components of that namespace can be used with unqualified references.

    | | *any attributes* |

    Optional. Specifies any other attributes with a non-schema namespace.

    |

    Example 1

    Example 2

    In this example, schema components in the http://www.w3.org/2001/XMLSchema namespace (element name, type) are unqualified, while http://www.w3school.com.cn/w3schoolschema (mystring) is qualified by the wsc prefix:

    xmlns:wsc="http://www.w3cschool.cc/w3shoolsschema">


    XML Schema Reference Manual Complete XML Schema Reference Manual