Namespace Prefixes
The name preceding the colon, the prefix, maps to an XML namespace identified by a Universal Resource Identifier (URI). The namespace ensures global uniqueness when merging XML sources, while the associated prefix—a short name that substitutes for the namespace URI—must be unique only in the tightly scoped context of the document. With this scheme, no conflicts exist between tags and attributes, and two tags can be the same only if they are from the same namespace and have the same tag name. This allows a document to contain both book and author information without confusion about whether the <TITLE>
element refers to the book or the author. If a computer program wanted to display the name of a book in a user interface, it would use the object model to look for the <TITLE>
element of the BookInfo
namespace.
Example
The following examples show the tiger
element prefixed with zoo
. This indicates that the animal element belongs to the zoo namespace as defined in the root element by the xmlns
attribute.
<zoo:tiger>
Other Resources
W3C Namespaces in XML Recommendation