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)".


> 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



Alexander Klimetschek

View raw message