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 ...

Get RELAX NG now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.