Default Namespaces : Namespace « Namespace « XML Tutorial





A default namespace is like a regular namespace.
You don't have to specify a prefix for all of the elements that use it. 

<person xmlns="http://www.java2s.com"> 
    <name> 
        <title>Sir</title> 
    </name> 
</person> 

You can declare more than one namespace for an element, but only one can be the default. 

<person xmlns="http://www.java2s.com" 
        xmlns:xhtml="http://www.w3.org/1999/xhtml"> 
    <name/> 
    <xhtml:p>This is XHTML</xhtml:p> 
</person>










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