Question - What is the purpose of XML Namespaces?
Answer -
An XML Namespace is a collection of element types and attribute names. It consists of 2 parts
1) The first part is the URI used to identify the namespace
2) The second part is the element type or attribute name itself.
Together they form a unique name. The various purpose of XML Namespace are
1. Combine fragments from different documents without any naming conflicts. (See example below.)
2. Write reusable code modules that can be invoked for specific elements and attributes. Universally unique names guarantee that
such modules are invoked only for the correct elements and attributes.
3. Define elements and attributes that can be reused in other schemas or instance documents without fear of name collisions. For
example, you might use XHTML elements in a parts catalog to provide part descriptions. Or you might use the nil attribute
defined in XML Schemas to indicate a missing value.
< Department >
< Name >DVS1< /Name >
< addr:Address xmlns:addr="http://www.tu-darmstadt.de/ito/addresses" >
< addr:Street >Wilhelminenstr. 7< /addr:Street >
< addr:City >Darmstadt< /addr:City >
< addr:State >Hessen< /addr:State >
< addr:Country >Germany< /addr:Country >
< addr:PostalCode >D-64285< /addr:PostalCode >
< /addr:Address >
< serv:Server xmlns:serv="http://www.tu-darmstadt.de/ito/servers" >
< serv:Name >OurWebServer< /serv:Name >