This section describes the syntax and semantics of the xmlns()
scheme and the behavior of XPointer processors with respect to this scheme.
The scheme name is "xmlns". The scheme data syntax is as follows; if scheme data in a pointer part with the xmlns()
scheme does not conform to the syntax defined in this section the pointer part does not contribute an entry to the namespace binding context.
[1] | XmlnsSchemeData | ::= |
NCName
S? '=' S? EscapedNamespaceName
|
[2] | EscapedNamespaceName | ::= |
EscapedData* |
S is as defined in the XML specification [XML], NCName is as defined in the XML Namespaces specification [XML-Names], and EscapedData is as defined in the XPointer Framework specification [XPtrFrame].
A pointer part with the xmlns()
scheme declares a namespace prefix (NCName) to be associated with an XML namespace name (EscapedNamespaceName with any circumflex-escaping undone). Each pointer part that uses the xmlns()
scheme contributes a new entry to the namespace binding context. If a pointer part defines a binding for a namespace prefix that already has an entry in the namespace binding context, the new entry overrides the old one.
For example, the following pointer part binds the abc prefix to the http://example.com/ns/abc namespace name:
xmlns(abc=http://example.com/ns/abc)
A pointer part that uses the xmlns()
scheme never identifies a subresource and thus the XPointer processor evaluation always continues with the next pointer part. However, evaluation of the xmlns
pointer part has a potential effect on pointer parts to its right.
The XPointer Framework on which this specification is based dictates that the initial namespace binding context prior to evaluation of the first pointer part consists of a single entry: the xml
prefix bound to the URI http:/www.w3.org/XML/1998/namespace
. Following the rules specified by the Framework, any attempt by a pointer part using the xmlns()
scheme to redefine the xml
prefix will result in no change to the namespace binding context. Any attempt to bind a prefix to the namespace name http://www.w3.org/XML/1998/namespace
will result in no change to the namespace binding context. Any attempt to define the xmlns
prefix will result in no change to the namespace binding context. Any attempt to bind a prefix to the namespace name http://www.w3.org/2000/xmlns/
will result in no change to the namespace binding context.
The prefix used in pointer parts need not match the prefix (or lack of a prefix) actually used in the XML resource into which the pointer part is addressing. For example, assume the following target XML resource:
<customer xmlns="http://example.org/customer"> <name xmlns="http://example.org/personal-info">John Doe</name> </customer>
Evaluation of a pointer part that refers to element customer
will not identify any subresources if the namespace binding context contains no entry that binds a prefix to the namespace name http://example.org/customer
. The following two pointer parts allow the xpointer() [XPointer] part to the right to refer to the customer
element (as c:customer
) and the name element (as p:name
):
xmlns(c=http://example.org/customer) xmlns(p=http://example.org/personal-info) xpointer(/c:customer/p:name)