6.6.1 XPath over Document View

When an XPath query is executed, the XPath expression specified is applied to the document view of the workspace being searched.

For example, consider a workspace with the following structure (based on the earlier example in Section, with the addition of a top-most root node):

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0"
<myapp:document jcr:primaryType="mynt:document">
myapp:title="JSR 170"
myapp:lead="Content Repository">
<myapp:body jcr:primaryType="mynt:body">
<myapp:paragraph jcr:primaryType="mynt:paragraph"
myapp:title="Node Types"
myapp:text="An important feature..."/>

Note that in the above, the XML has been formatted for readability. The actual XML stream might not have any extraneous whitespace between elements or attributes.

In this case, to find the node called myapp:paragraph, the following XPath expression would be used:

//element(*, mynt:paragraph)[@myapp:title="Node Types"]

This query will return the node at the repository workspace path (as opposed to an XPath):