• +49-(0)721-402485-12
Ihre Experten für XML, XQuery und XML-Datenbanken

Location paths

A location path is a formulation which allows the access and selection of certain nodes or node sets within a XML document. Location paths

  • can have a short or a detailed notation
  • can be relative or absolute.

Short and detailed syntax

A path expression in XPath can have a detailed or a short notation. Whereas the detailed syntax is used for nodes and axes being rarely addressed, there is a short notation for often selected nodes and axes. The name "child::" for the child axis can in principle be omitted since it is considered as standard axis.

An example for the detailed notation:


The short notation:


When using the short notation, the name of the child axis is omitted and the attribute note is abbreviated by the @ character.

Comparison of the detailed and the short syntax:

axis/nodedetailed notationshort notation
node itselfself::node().
childrenchild::standard axis (default),
the indication can be left out

Absolute and relative paths

A path in XPath may be relative or absolute. Whereas relative paths start from the (current) context node, an absolute location path origins from the root node. A location path consists of several location steps which are separated by slashes. A location step contains the indication of an axis, the indication of a node test and one (or several) predicate(s), whereby the indication of predicates is optional.


The first slash marks the root node. From there, the <UNIVERSITY> root element is selected which must have a <POLITICS> child element which, in turn, must have a <DEAN> child element in order to get a match. The axes are indicated along with their names followed by two colons.

In short notation, the path is as follows:


Relative paths begin with a double slash and make a search in the entire document possible:


Now, the entire document is searched for the <POLITICS> element and its <DEAN> child element. In case this combination can be found in the document, a match occurs.

<< backnext >>