XML namespace: Difference between revisions

Content deleted Content added
No edit summary
m Namespace declaration: Abbreviation cleanup, capitalization etc
Line 4:
 
== Namespace declaration ==
A namespace is declared using the reserved XML attribute <code>xmlns</code>, the value of which must be a [[Uniform Resource Identifier|URI]] (Uniform Resource IdentifierURI) reference.
 
For example:
Line 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 pagedocument at [http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml] itself does not contain any code,. itIt simply describes the [[xhtmlXHTML]] namespace to human readers. Using a URLURI (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: