XML Base

from Wikipedia, the free encyclopedia

XML Base is a way recommended by the World Wide Web Consortium to define base URLs for parts of XML documents. Base URL is the URL from which relative path information in the document is resolved. The XML Base Recommendation was introduced on June 27, 2001 .

The xml: base attribute can be inserted anywhere in XML documents in order to use a different base URL than that of the document or an external URI or external entity . The value of the attribute is interpreted as a URI reference as defined in RFC 2396 [IETF RFC 2396 ] after it has been processed as in Part 3.1 of the specification.

In XML processors that take XML namespaces into account, the "xml" prefix is ​​linked to the namespace designation, as described there under Namespaces in XML . Nevertheless, xml: base can also be used by processors that do not process namespaces.

example

The following XML document is in place file:///var/www/beispiel.xml

<body xmlns="http://www.w3.org/1999/xhtml">
  <a href="/wiki/XML_Base">Link 1</a>
  <a xml:base="http://de.wikipedia.org" href="/wiki/XML_Base">Link 2</a>
  <div xml:base="file:///home/user/">
    <a href="test2.xml">Link 3</a>
    <a xml:base="ordner" href="test3.xml">Link 4</a>
  </div>
</body>

Then the links are resolved as follows:

  1. Link 1 leads to file:///wiki/XML_Base
  2. Link 2 to http://de.wikipedia.org/wiki/XML_Base
  3. Link 3 to file:///home/user/test2.xml
  4. Link 4 to file:///home/user/ordner/test3.xml

Web links

Individual evidence

  1. The "xml:" Namespace ( English ) .w3.org. October 26, 2009. Retrieved September 14, 2019.