namespace in XML 1) are used to be able to have the same node name but in different namespace.
A simple example would be to consider an XML document that contained references to:
Both the customer element and the product element could have a child element named id (for identifier).
References to the id element would therefore be ambiguous; placing them in different namespaces would remove the ambiguity.
<xml xmlns:c="https://domain.com/customer" xmlns:p="https://domain.com/product">
<c:id>The customer id</c:id>
<p:id>The product id</p:id>
</xml>
XML namespaces are used mainly for providing uniquely named elements and attributes in an XML document.
For a schema vocabulary, the XML namespace provides a naming context for:
The namespace mechanism defines custom namespaces in which the non-standard elements and attributes are supported.
A namespace name is a uniform resource identifier (URI) and is declared using the reserved XML pseudo-attribute:
For example, the following JSF tag library declaration maps the h prefix to the http://java.sun.com/jsf/html namespace uri.
<xml xmlns:h="http://java.sun.com/jsf/html" >
http://java.sun.com/jsf/html doesn't represent a web page, it's just an unique identifier
The default namespace of a document is defined without the name.
Example for an XHTML document
<html xmlns="http://www.w3.org/1999/xhtml">