3 Language and Processing

This section describes the syntax and semantics of the element() scheme and the behavior of XPointer processors with respect to this scheme.

The scheme name is "element". The scheme data syntax is as follows; if scheme data in a pointer part with the element() scheme does not conform to the syntax defined in this section the pointer part does not identify a subresource.

element() Scheme Syntax
[1]   ElementSchemeData   ::=   (NCName ChildSequence?) | ChildSequence
[2]   ChildSequence   ::=   ('/' [1-9] [0-9]*)+

The scheme data consists of either a NCName (as defined in the XML namespaces specification [XML-Names]) or a child sequence, or both.

A NCName appearing alone identifies a single element exactly as it would in a shorthand pointer, as defined in the XPointer Framework [XPtrFrame] specification, except that failure to identify an element results simply in no subresource being identified by this pointer part rather than an XPointer Framework error.

For example, the following pointer part identifies the element with an ID (as defined in XPointer Framework) of "intro":

element(intro)

A child sequence appearing alone identifies an element by means of stepwise navigation, which is directed by a sequence of integers separated by slashes (/); each integer n locates the nth child element of the previously located element. The integer n following the first slash locates the nth top-level element: either the unique document element (the [document element] property, if the resource is an XML document, in which case the integer is always 1) or one of potentially several root elements (the entity root element(s), if the resource is an external parsed entity). For example, assuming that the XML resource is a whole XML document, the following pointer part identifies the second child element inside the root element of the document:

element(/1/2)

A child sequence appearing after an NCName identifies an element by means of stepwise navigation, starting from the element located by the given name. For example, the following pointer part identifies an element by first locating the element identified by the value "intro", then locating that element's third child element, then finally identifying that element's first child element:

element(intro/3/1)

If either the NCName or the child sequence does not locate an element, no element is identified by the pointer part as a whole.

The element() scheme does not use the namespace binding context because it does not support qualified names.