Default namespace for encoded XML
In an XML instance document that uses namespaces, there is an option to define a default namespace. In this way, all unqualified XML elements in the XML document are processed as being qualified by this default namespace.
For example:
Without the default namespace declared:
<?xml version="1.0"?>
<apo:purchaseOrder xmlns:apo="http://www.example.com/PO1"
orderDate="1999-10-20">
<apo:shipTo country="US">
<apo:name>Alice Smith</apo:name>
<apo:street>123 Maple Street</apo:street>
<!-- etc. -->
</apo:shipTo>
<apo:billTo country="US">
<apo:name>Robert Smith</apo:name>
<apo:street>8 Oak Avenue</apo:street>
<!-- etc. -->
</apo:billTo><apo:comment>Hurry, my lawn is going wild<!/apo:comment>
<!-- etc. -->
</apo:purchaseOrder>
With the default namespace declared:
<?xml version="1.0"?>
<purchaseOrder xmlns="http://www.example.com/PO1"
orderDate="1999-10-20">
<shipTo country="US">
<name>Alice Smith</name>
<street>123 Maple Street</street>
<!-- etc. -->
</shipTo>
<billTo country="US">
<name>Robert Smith</name>
<street>8 Oak Avenue</street>
<!-- etc. -->
</billTo>
<comment>Hurry, my lawn is going wild<!/comment>
<!-- etc. -->
</purchaseOrder>