XML Namespaces

Create universally unique names in XML, and annotate them using RDDL

XML Namespaces allow you to provide universal names for elements and attributes in XML documents. Discover why and when you should take advantage of XML Namespaces, and learn about the importance of Resource Directory Description Language (RDDL).

Contributors:  W3C

25 April 2007 (First published 06 February 2007)

XML Namespaces allow you to provide universal names for elements and attributes in XML documents. Discover why and when you should take advantage of XML Namespaces, and learn about the importance of Resource Directory Description Language (RDDL).

Namespaces in XML 1.0 (Second Edition) [W3C Recommendation] provides a mechanism for the universal naming of elements and attributes in XML documents. Here is a simple example that explains the motivation behind XML Namespaces: Imagine that you have an XML vocabulary in which elements named "head" and "body" are marked as anatomical descriptions, but you wish to embed XHTML snippets in the document. XHTML also defines "head" and "body" elements. How do you distinguish the XHTML elements from the host vocabulary elements of the same name? Using XML Namespaces, you would assign a vocabulary marker to each. In XML Namespaces, each vocabulary is called a namespace, and there is a special syntax for expressing a namespace name (which is defined as a Uniform Resource Identifier (URI)) associated with each element or attribute. Each element or attribute name can be connected to one namespace, and in this way you could distinguish the anatomical "head" from the XHTML "head." Among XML experts, XML Namespaces have been controversial because they add quite a bit of complexity to the XML processing model, and some people think the gain does not warrant the problems. Nevertheless, XML Namespaces have become almost universally accepted among XML users, and they are addressed in almost all XML processing technologies.

Namespaces in XML 1.1 (Second Edition) [W3C Recommendation] is an update that incorporates errata and adds, among other things, support for Internationalized Resource Identifiers (IRIs) and support for nullifying a namespace declaration.

RDDL

One issue that often comes up in association with XML Namespaces is what sorts of resources should be associated with the URI for a namespace. The XML expert community, led by Jonathan Borden and Tim Bray, came up with Resource Directory Description Language (RDDL) [Community Standard] as a standard for packaging information on a namespace. RDDL uses XHTML to provide prose descriptions of the vocabulary with embedded XLinks to provide pointers to key resources for helping understand or process the namespace. RDDL Version 2.0 [in development] is an update that seeks to replace XLink with two options: Resource Description Framework (RDF) or alternative XML linking suggestions developed on the mailing list for the W3C Technical Architecture Group (TAG).

Resources

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=XML
ArticleID=193472
SummaryTitle=XML Namespaces
publish-date=04252007