XML namespaces, tagged xmlns, are used for providing uniquely named elements and attributes in an XML document. An XML instance may contain element or attribute names from more than one XML vocabulary. If each vocabulary is given a namespace, the ambiguity between identically named elements or attributes can be resolved.
A namespace name is a uniform resource identifier (URI) and describes a resource under the control of the author or organisation defining the vocabulary, such as a URL for the author’s Web server. It is however not required to use the URI to retrieve informations. The URI is treated as a string and describes the namespace to human readers. Despite the absence of any formal relationship of the URI with the HTTP protocol, the use of an URL form is common.
It’s not required that a document is available at the named address, but one convention adopted by developers is to place a Resource Directory Description Language (RDDL) document at the location of the URI.
The default namespace is declared as :
<html xmlns="http://www.w3.org/1999/xhtml">
The Facebook namespace is declared as :
<html xmlns:fb="http://ogp.me/ns/fb#">
To use both namespaces in one document, the declarations are combined :
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
Further informations about namespaces are available at the following links :
- XML namespaces, by w3schools.com
- XML Namespaces by Example, by Tim Bray