Names and namespaces
Expanded name
The pair of namespace URI and local name that a QName resolves to — what processors actually compare when they match a name.
Two elements are the same element type when their expanded names match. The prefix is not part of the comparison, which is why a document can rename every prefix it uses without changing meaning, and why a diff that compares tag text reports changes that are not there.
Some tooling writes expanded names in Clark notation — {http://www.w3.org/2005/Atom}entry — precisely because it is unambiguous where a prefixed name is not.
- Defined in
- Namespaces in XML 1.0 §2.1
- Category
- Names and namespaces
- Also written
- universal name, {uri}local
Shown, not asserted
All 2 claims are executed on every test run, against the same engines the tools use. If the behaviour changes, the test fails rather than this page quietly becoming wrong.
The namespace URI is the half that carries meaning.
document.xml <r xmlns:a="urn:a"><a:c/></r>expression namespace-uri(//*[local-name()='c'])What the engine returns
urn:aThe prefix is not: change it and the expanded name is unchanged.
document.xml <r xmlns:zzz="urn:a"><zzz:c/></r>expression namespace-uri(//*[local-name()='c'])What the engine returns
urn:a
What catches people out
- A structural diff must compare expanded names. Comparing tag text reports a difference every time a prefix changes.
- Clark notation is a convention of tooling, not of XML. You cannot write {uri}local in a document.
- Attributes have expanded names too, and an unprefixed attribute's namespace URI is empty rather than the element's.
Where it bites
A definition on its own is trivia. These are the pages where this term decides whether a document works.
- ToolsXML diffCompares structure rather than text, which is what makes prefix changes invisible to it.
- XPathnamespace-uri()Returns the URI half of the expanded name.
- XPathlocal-name()Returns the other half.
Related terms
- QNameA qualified name: an optional namespace prefix, a colon, and a local name — the form every element and attribute name takes in a namespaced document.
- NamespaceA URI that qualifies element and attribute names, so identically-named elements from different vocabularies can coexist in one document.
- Namespace prefixThe short NCName bound to a namespace URI by an xmlns:prefix declaration, used before a colon to qualify names.
- Canonicalization (C14N)Rewriting a document into a single normal form — sorted attributes, expanded empty elements, resolved references, no declaration — so that equivalent documents become byte-identical.
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.