by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)


Name

xsd:QName — Namespaces in XML-qualified names

Synopsis

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

Derived from

xsd:anySimpleType

Primary

xsd:QName

Known subtypes

None

Data parameters (facets)

enumeration, length, maxLength, minLength, pattern

Description

The lexical space of xsd:QName is a qualified name according to Namespaces in XML. It is a local name (which is an xsd:NCName) with an optional prefix (itself an xsd:NCName), separated by a colon. 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.

Restrictions

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

The usage of QNames in elements and attributes is controversial because 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 provided some examples of QNames. When I wrote "<xsd:attribute name="lang" type="xsd:language"/>", the type attribute was a xsd: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 "xsd:". If there is no namespace declaration for this prefix, the type attribute is considered invalid.


This text is released under the Free Software Foundation GFDL.