Multiple namespaces in XML can be declared for various elements, child elements, attributes and contents in a document.  Multiple namespaces are helpful to merge multiple documents or multiple DTDs into one document When multiple namespaces are declared, a namespace’s scope is limited within the elements where namespace is declared.

Example of multiple namespaces

<e:area xmlns:e="">

    <c:country xmlns:c="">




    <e:population>110 billion</e:population>


The above example has the root element “area” defined in namespace “a”. It has “country “ and “population” as child elements. Country is defined in another namespace “c”. Hence the child elements of country, the “name" and “capital” has “c” as namespace. XML parsers determine namespace from URI than prefixes.


›› go to examples ››