Skip to main content

XML namespace

The reserved xml: namespace

Bound to the xml: prefix implicitly and permanently, and the source of xml:lang, xml:space, xml:base and xml:id. Never declare it, never rebind it.

xmlns:xml="http://www.w3.org/XML/1998/namespace"

The xml: prefix is bound to this URI by the XML specification itself. It needs no xmlns:xml declaration, and Namespaces in XML §2.3 forbids binding the prefix to any other URI.

Forbidden is not the same as caught, and this is a case where the two come apart. libxml2 — the parser behind this site, and behind PHP, lxml and Nokogiri — accepts a document that rebinds xml: to a different URI without a word of complaint. The rule is real, nothing enforces it for you, and a document relying on that silence will break the day it meets a parser that does check.

It supplies the four attributes every XML vocabulary can use: xml:lang, xml:space, xml:base and xml:id.

URI
http://www.w3.org/XML/1998/namespace
Prefix
xml
Elements
Contributes attributes only

Specification: Namespaces in XML 1.0

Get started

Bring order to the XML your team can't afford to ignore.

Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.