Namespace Examples
ns.xml:
<?xml version="1.0" ?>
<!-- define the default namespace -->
<root xmlns="http://www.php.net/">
<!-- the element package belongs to the namespaceURI
"http://pear.php.net/" with the prefix "a"
-->
<something xmlns:a="http://pear.php.net/">
<a:package>XML_Beautifier</a:package>
</something>
<!-- This is exactly the same as above, just the
prefix changed, which doesn't change the meaning
of the document -->
<something xmlns:b="http://pear.php.net/">
<b:package>XML_Beautifier</b:package>
</something>
<!-- This is again the same as above. We declared in the
element package "http://pear.php.net/" as the default
Namespace. The absent prefix doesn't influence the meaning
of the document -->
<something>
<package xmlns="http://pear.php.net/">XML_Beautifier</package>
</something>
<!-- Again the same... Namespace definitions can be overwritten
in childnodes -->
<something xmlns:b="http://www.php.net/">
<b:package xmlns:b="http://pear.php.net/">XML_Beautifier</b:package>
</something>
</root>
Sax Summary
© copyright 2004 Bitflux GmbH