Content deleted Content added
No edit summary |
|||
Line 1:
'''XML namespaces''' are
A simple example would be to consider an XML instance that contained references to a customer and an ordered product. Both the customer element and the product element could have a child element "ID_number". References to the element ID_number would therefore be ambiguous unless the two identically named but semantically different elements were brought under namespaces that would differentiate them.
Line 12 ⟶ 10:
<pre><nowiki>xmlns="http://www.w3.org/1999/xhtml"</nowiki></pre>
Note, however, that the URI is not actually read as an online address; it is simply treated by an XML parser as a string. For example, the page at [http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml] itself does not contain any code, it simply describes the [[xhtml]] namespace to human readers. Using a URL (such as <nowiki>"http://www.w3.org/1999/xhtml"</nowiki>) to identify a namespace, rather than a simple string (such as "xhtml"), reduces the possibility of different namespaces using duplicate identifiers.
It is also possible to map namespaces to prefixes in namespace declarations. For example:
<pre><nowiki>xmlns:xhtml="http://www.w3.org/1999/xhtml"</nowiki></pre>
In this case, any element or attribute names that start with the prefix "xhtml:" are considered to be in the XHTML namespace.
== External links ==
*[http://www.w3.org/TR/REC-xml-names/ W3C Recommendation: Namespaces in XML,
*[http://www.w3.org/TR/xml-names11/ W3C Recommendation: Namespaces in XML, version 1.1]
*[http://xml.coverpages.org/namespaces.html Cover Pages: Namespaces in XML]
*[http://www.service-architecture.com/xml/articles/common_xml_vocabularies.html Common XML Vocabularies]
|