Error location path and namespace context

This is defined as a list of element and attribute nodes in the format of an XPath expression which denotes the closest ancestor to the failure point which has passed sufficient well-formedness or validation checks to be XPath identifiable as a node. If the enhanced error information feature is enabled, then position indexes will be included in the XPath expression for any nodes whose position is greater than 1.
Note: In the XPath specification, the position is 1 based.

If the XML document includes namespace definitions, then the nodes in the expression will be namespace prefix qualified as they were in the original XML document. In addition, the namespace context at the point of the failure is provided. If no namespaces URIs are applicable at the point of the failure, then the length of the namespace context field will be 0. If the path denotes a PI or comment, then the corresponding step in the namespace definition will not be present.

If fragment parsing is in progress when the error occurs, the path will only include nodes that had been parsed in the current document fragment. It will not include nodes which were only passed in by way of the load fragment context CTL call.

The error location path follows the definitions in the XPath 1.0 specification. The following XPath constructs are used:
'/'
This identifies the root node of the document and includes prolog and miscellaneous nodes which are XPath identifiable as comments and processing instructions. If an error occurs in the root element's type (qname), then the path will be /. If the error location path is present, it will always begin with '/'.
location step
Consists of a node test. The following node tests are supported:
QName
This corresponds to element nodes in the path and will be a prefix:localname if the qname is namespace qualified. Elements using default namespaces will not have a prefix.
@Qname
This corresponds to attribute nodes in the path will be a prefix:localname if the qname is namespace qualified. This can only appear at the end of the path.
comment()
This is used when an error occurs in an XPath identifiable comment.
processing-instruction('name')
This is used when an error occurs in a processing instruction. The 'name' is a string which represents the name of the processing instruction if it was correctly specified in the document.
[n]
This is the 1 based position index which will be appended to a qname if the enhanced location feature is enabled and the position index of the node is > 1.
Additional usage notes are as follows: