DB2 10.5 for Linux, UNIX, and Windows
Qualified names (QNames)
A QName consists of an optional namespace prefix and a local name. The namespace prefix and the local name are separated by a colon. The namespace prefix, if present, is bound to a URI (Universal Resource Identifier) and provides a shortened form of the URI.
During query processing, XQuery expands the QName and resolves the URI that is bound to the namespace prefix. The expanded QName includes the namespace URI and a local name. Two QNames are equal if they have the same namespace URI and local name. This means that two QNames can match even if they have different prefixes provided that the prefixes are bound to the same namespace URI.
The following example includes the QNames:
- ns1:name
- ns2:name
- name
<ns1:name>This text is in an element named "name" that is qualified
by the prefix "ns1".</ns1:name>
<ns2:name>This text is in an element named "name" that is qualified
by the prefix "ns2".</ns2:name>
<name>This text is in an element named "name" that is in the default
element namespace.</name>
The elements in this example
share the same local name, name, but naming conflicts
do not occur because the elements exist in different namespaces. During
expression processing, the name ns1:name is expanded
into a name that includes the URI that is bound to ns1 and
the local name, name. Likewise, the name ns2:name is
expanded into a name that includes the URI that is bound to ns2 and
the local name, name. The element name,
which has an empty prefix, is bound to the default element namespace
because no prefix is specified. An error is returned if a name uses
a prefix that is not bound to a URI.QNames (qualified names) conform to the syntax that is defined in the W3C recommendation Namespaces in XML.