Using Prefixes : Namespace « Namespace « XML Tutorial






URIs must be used for the prefix names. 
A URI (Uniform Resource Identifier) is a string of characters that identifies a resource. 
It can be URL (Uniform Resource Locator) or URN (Universal Resource Name). 
The URL we're using is simply used as a name, for the namespace.
XML parser won't try to pull back any resources from that location.
XML parser uses it for naming the namespaces in the document. 

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
   <title>Book List</title>
  </head>
  <body>
   <pub:publications
   xmlns:pub="http://www.java2s.com/namespaces/pub">
    <pub:book>
     <pub:title>Mastering XHTML</pub:title>
     <pub:author>Ed Tittel</pub:author>
    </pub:book>
    <pub:book>
     <pub:title>Java Developers Guide to E-Commerce
     with XML and JSP</pub:title>
     <pub:author>William Brogden</pub:author>
    </pub:book>
   </pub:publications>
  </body>
</html>








2.1.Namespace
2.1.1.Why We Need Namespaces
2.1.2.How XML Namespaces Work
2.1.3.Default Namespaces
2.1.4.Declaring Namespaces on Descendants
2.1.5.Understanding URIs
2.1.6.Change URI of namespace
2.1.7.Using Prefixes