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.
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) .
- While some XML tutorials cover XML Namespaces, focus on
learning the practical use of namespaces from David Marston in Plan
to use XML namespaces, Part 1 (developerWorks, April 2004) and Plan to use XML namespaces, Part 2 (developerWorks,
April 2004).
- Understand and learn to avoid the real-life pitfalls of
namespaces in Principles of XML design: Use XML namespaces with care
by Uche Ogbuji (developerWorks, April 2004).
- Uche Ogbuji provides an introduction to RDDL in Use
RDDL with your XML and Web services namespaces (developerWorks, May
2004).
- Ronald Bourret maintains the XML Namespaces
FAQ.
- James Clark offers a close examination of namespaces and
introduces a popular notation for describing namespaces in his essay, XML Namespaces.
- Read a stern note of caution from Parand Darugar in Abolish XML namespaces? (developerWorks, July
2005).
- Read about other XML standards:
Index of XML
standards.
- Participate in any of several XML-centered forums:
XML
zone discussion forums.
- Get involved in the developerWorks community: developerWorks blogs
- Find out how you can become an IBM-Certified
Developer in XML and related technologies at IBM XML
certification.
- See the developerWorks XML Zone for a wide range of
technical articles and tips, tutorials, standards, and IBM Redbooks at
XML
technical library.
- Stay current with technology in these sessions: developerWorks technical events and webcasts.
- Build your next development project with trial
software available for download directly from developerWorks: IBM trial software
