jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: xpath and root node
Date Thu, 15 Jul 2010 10:08:59 GMT
On Thu, Jul 15, 2010 at 00:37, ChadDavis <chadmichaeldavis@gmail.com> 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
alexander.klimetschek@day.com

Mime
View raw message