Mega Code Archive

 
Categories / XML Tutorial / Namespace
 

Using Prefixes

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.rntsoft.com/namespaces/pub">     <pub:book>      <pub:title>Mastering XHTML</pub:title>      <pub:author>Ed Tittel</pub:author>     </pub:book>     <pub:book>      <pub:title>Java Developer’s Guide to E-Commerce      with XML and JSP</pub:title>      <pub:author>William Brogden</pub:author>     </pub:book>    </pub:publications>   </body> </html>