XML namespace
XML namespaces are used for providing uniquely named elements and attributes in an XML document. They are defined in a W3C recommendation. 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 simple example would be to consider an XML instance that contained references to a customer and an ordered product. Both the customer element and the product element could have a child element named id. References to the id element would therefore be ambiguous; placing them in different namespaces would remove the ambiguity.
XML namespaces are used for providing uniquely named elements and attributes in an XML document. They are defined in a W3C recommendation. 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 simple example would be to consider an XML instance that contained references to a customer and an ordered product. Both the customer element and the product element could have a child element named id. References to the id element would therefore be ambiguous; placing them in different namespaces would remove the ambiguity. xmlns:xhtml="http://www.w3.org/1999/xhtml" Any element or attribute whose name starts with the prefix "xhtml:" is considered to be in the XHTML namespace, if it or an ancestor has the above namespace declaration. It is also possible to declare a default namespace. For example: xmlns="http://www.w3.org/1999/xhtml" In this case, any element without a namespace prefix is considered to be in the XHTML namespace, if it or an ancestor has the above default namespace declaration. If there is no default namespace declaration in scope, the namespace name has no value. In that case, an element without an explicit namespace prefix is considered not to be in any namespace. Attributes are never subject to the default namespace. An attribute without an explicit namespace prefix is considered not to be in any namespace. ==See also== Namespace ==References== ==External links== Namespaces in XML 1.0 (Third Edition) Namespaces in XML 1.1 (Second Edition) Namespaces Crash Course (Mozilla Developer Network) ja:Extensible Markup Language#XML名前空間
References
No reference rows published for this article.
Cite this article
MLA
"XML namespace." encyclopegia.org, 2025, https://encyclopegia.org/wiki/xml-namespace. Accessed 25 November 2026.
Chicago
"XML namespace." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/xml-namespace.
APA
encyclopegia.org. (2025). XML namespace. Retrieved November 25, 2026, from https://encyclopegia.org/wiki/xml-namespace
Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON