encyclopegia.org

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

Related articles

XML Schema

stub · references available

RDF/XML

stub · references available

Office Open XML

stub · references available

Java XML Binding

stub · references available

XML validation

stub · references available

OpenOffice.org XML

stub · references available

XML Events

stub · references available

Windows Shell namespace

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1300931353 · 0.5 · snapshot enwiki-001300931353

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.