Name

xs:QName — Namespaces in XML qualified names.

Derived from:

xs:anySimpleType

Primary:

xs:QName

Known subtypes:

none

Facets:

xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace

<xs:simpleType name="QName" id="QName">
  <xs:restriction base="xs:anySimpleType">
    <xs:whiteSpace value="collapse" fixed="true"/>
  </xs:restriction>
</xs:simpleType>

Description

The lexical space of xs:QName is the qualified names per Namespace in XML, i.e., a local name (which is a xs:NCName) with an optional prefix (itself a xs:NCName), separated by a colon (“:”), where the prefix is declared a namespace prefix in the scope of the element carrying the value. Its value space comprises the pairs (namespace URI, local name) in which the namespace URI is the URI associated to the prefix in the namespace declaration.

This dissociation between lexical and value spaces makes a lot of difference when using facets such as xs:pattern (which acts on the lexical space only and thus constrains the namespace prefix) and xs:enumeration (which acts on the value space and thus constrains the namespace URI).

Restrictions

It is impossible to apply a pattern on the namespace URI.

The usage of QNames in elements and attributes is controversial since it creates a dependency between the content of the document and its markup. However, the official position of the W3C doesn’t discourage this practice.

Example

W3C XML Schema itself has already given us some examples of QNames. When we wrote "<xs:attribute name="lang" type="xs:language"/>", the type attribute was a xs:QName and its value was the tuple {"http://www.w3.org/2001/XMLSchema", "language"} because the URI "http://www.w3.org/2001/XMLSchema" had been assigned to the prefix "xs:". If there had been no namespace declaration for this prefix, the type attribute would have been considered invalid.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.252.140