On Thu, Jul 15, 2010 at 00:37, ChadDavis <[email protected]> wrote:
> Do you have to start your xpath expression with "/jcr:root/" to
> indicate a path relative to the root of the repository?

Yes. The only exception is if you start with the descendant-or-self
wildcard location step, eg. "//*" or "//element(*, nt:file)".

http://www.day.com/specs/jcr/1.0/6.6.4.3_Context_Node.html
http://www.day.com/specs/jcr/1.0/6.6.3.4_Path_Constraint.html

> Why can't you simply start with a single slash?

Because the query is mapped onto the XML document view. That defines
the root named "jcr:root" as you need to be able to explicitly specify
the root node in XML document view. The normal name of the JCR root
node is an empty string, which is not a valid XML element name, hence
the "jcr:root".

I guess it would have been possible to short-cut this in XPath, but I
think one wanted to be concise with the Xpath-over-XML-document view
mapping.

http://www.day.com/specs/jcr/1.0/6.4.2.2_Workspace_Root.html

Regards,
Alex

-- 
Alexander Klimetschek
[email protected]

Reply via email to