- Why Namespaces Are Needed: Resolving Name Conflicts
- Qualified Names, Prefixes, Local Names, and Other Terminology
- Declaring Namespaces in XML Documents
- Default Namespace
- Handling Namespaces in a DTD or XML Schema
- Validating Documents with Namespaces
- What Does a Namespace Point To?
- Namespace Support and Use
- Special Attributes: xmlns, xml:space, xml:lang, and xml:base
- Common Namespaces
- Summary
- For Further Exploration
Common Namespaces
Before we turn to XML Information Set and Canonicalization of XML, there's one more Namespace topic to cover.
Table 5-1 presents an illustrative but not exhaustive list of namespaces with which you should become familiar.7 Although I've included mostly W3C namespaces, you'll note a few namespaces from other organizations as well. A more extensive list of namespaces can be found on ZVON.org in their Namespace Reference (http://www.zvon.org/index.php?nav_id=172). Note that the prefix given is strictly by convention; you will most likely encounter the prefixes shown, but you may actually use any prefix as long as it is associated with the correct URI. Several key aspects of namespaces are illustrated in this table and are worth emphasizing:
The same prefix appears in several rows (e.g., xsl:), but each is associated with a different URI. Once again, it's the actual URI that really matters, not the prefix. Therefore, each of the xsl: prefixes refers to a different namespace.
The namespace URI given in the rightmost column need not resolve to an actual Web page or document. In other words, don't expect that following the link will have a useful result.
There is no convention about the format of the URI itself. As the table entries illustrate, the URI may end in a slash, it may be a HTML page or a fragment within a page, it may be XML, or it may be simply a URI that is nothing more than an identifier, with no physical manifestation. It is crucial that you use exactly the URIs shown in the table, character for character, uppercase or lowercase as shown. If not, results will vary across tools. XSLT processors, for example, produce cryptic errors if you use anything but the http://www.w3.org/1999/XSL/Transform URI for the XSLT namespace. (A lowercase "t" or an ending slash can cause havoc.)
The year portion of a W3C namespace URI is not the year of the specification; it's the year the namespace was assigned. For example, the MathML URI contains the year 1998, even though MathML 2.0 is a 2001 recommendation. Note that most, but not all, W3C assigned namespaces contain a year-of-assignment designation. Those that do not, however, are of particularly old vintage and generally should not be used.
TABLE 5-1 Common Namspaces
Prefix Convention |
Purpose and/or Specification |
Namespace URI |
Core Namespaces |
||
xml: |
Limited namespace for the xml: prefix, as used in xml:lang, xml:space, xml:base, etc. See http://www.w3.org/TR/REC-xml-names/. |
|
xmlns: |
Limited namespace containing only the xmlns: attribute, used only in specialized contexts such as the DOM. See http://www.w3.org/TR/REC-xml-names/ and the resource that just happens to be located by the namespace URI, http://www.w3.org/ 2000/xmlns/. |
|
xhtml: |
Extensible HyperText Markup Language (XHTML) namespace. See http://www.w3.org/TR/xhtml1 and chapter 15. |
|
xlink: |
XML Linking Language (XLink) namespace, often used in conjunction with attributes attached to arbitrary elements from other namespaces, such as xlink:simple, xlink:href, xlink:show, xlink:actuate, etc. See http://www.w3.org/TR/xlink/ and chapter 13. |
|
xi: |
XML Inclusions (XInclude) namespace. See http://www.w3.org/TR/xinclude/. |
|
XSL/XSLT Namespaces |
||
fo: |
XSL Formatting Objects namespace from the XSL 1.0 Recommendation. See http://www.w3.org/TR/xsl/ and chapter 12. |
|
xsl: or transform: |
XSL Transformations namespace from the XSLT 1.0 Recommendation. See http://www.w3.org/TR/xslt and chapter 11. |
|
xsl: |
[Obsolete] XSL Transformations name- space from the April 1999 XSLT Working Draft. |
|
xsl: |
[Obsolete] XSL Transformations namespace from the December 1998 XSL Working Draft supported by early versions of Microsoft's MSXML3 (and in early version of Internet Explorer 5.x). |
|
saxon: |
Saxon XSLT Extensions [Michael Kay]. See http://saxon.sourceforge.net/saxon6.5/ extensions.html or generally http://saxon.sourceforge.net/ and chapter 11. |
|
xalan: or lxslt: |
Xalan XSLT Extensions and Extension Library. See http://xml.apache.org/xalan-j/ extension.html and also http://xml.apache.org/xalan-j/extensionslib.html and chapter 11. |
|
exsl |
Extensions to XSLT 1.0 (EXSLT 1.0)Common [Jeni Tennison]. See chapter 11 and http://www.jenitennison.com/xslt/exslt/ common/, http://www.jenitennison.com/xslt/ exslt/functions/, http://www.jenitennison. com/xslt/exslt/math/, and http://www. jenitennison.com/xslt/exslt/sets/. |
http://xmlns.opentechnology.org/xslt-extensions/common |
Schema Namespaces |
||
xsd: |
XML Schema Part 1: Structures namespace. See http://www.w3.org/TR/xmlschema-1/ and chapter 6. |
|
dt: |
XML Schema Part 2: Datatypes namespace. See http://www.w3.org/TR/xmlschema-2/ and chapter 6. |
|
xsi: |
Namespace for XML Schema attributes used in XML instances (documents), such as xsi:type, xsi:schemaLocation, and xsi:nil. See chapter 6 and http://www.w3.org/ TR/xmlschema-1/#Instance_Document_ Constructions. |
|
rdfs: |
Resource Description Framework (RDF) Schema Specification 1.0. See http://www.w3.org/TR/2000/CR-rdf-schema-20000327/ and chapter 16. |
|
rdf: |
Resource Description Framework (RDF) Model and Syntax Specification. See http://www.w3.org/TR/REC-rdf-syntax/ and chapter 16. |
|
[none] |
XML Topic Maps (XTM) 1.0 |
|
Specialized Namespaces |
||
xf: |
XQuery 1.0 and XPath 2.0 Functions and Operators Version 1.0 namespace. See http://www.w3.org/TR/xquery-operators/. |
http://www.w3.org/2001/08/ xquery-operators Note: Since this applies to a working draft, the URI is likely to change. |
svg: |
Scalable Vector Graphics namespace. See http://www.w3.org/TR/SVG/. |
|
smil: |
Synchronized Multimedia Integration Language (SMIL) 2.0. See http://www.w3.org/ TR/smil20/. |
|
smil: |
[Obsolete] Synchronized Multimedia Integration Language (SMIL) 1.0. See http://www.w3.org/TR/REC-smil/. |
|
m: or mml: |
Mathematical Markup Language (MathML) Version 2.0. See http://www.w3.org/ TR/MathML2/. |