jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jou Kou-Rong" <Kou-Rong....@irs.gov>
Subject RE: How to retrieve a node from a hierarchy?
Date Thu, 26 Feb 2009 16:26:42 GMT
Use node walking, starting from rootNode (session.getRootNode()).
Or if you have defined your node structure with a certain pattern, then
you can follow the pattern to reach your node quickly. For example, you
map a file in a local file system to a JCR repository node with a
File system side: folder1/filder2/file1
JCR Node side: get appRootNode of your application, 
folder1Node = appRootNode.getNode("folder1");

-----Original Message-----
From: Akil Ali [mailto:Akil.Ajani@cognizant.com] 
Sent: Thursday, February 26, 2009 10:57 AM
To: users@jackrabbit.apache.org
Subject: Re: How to retrieve a node from a hierarchy?

Sorry to say, i dont want to use neither XPATH nor UUID. so what would
be the other solution to get the node.


Alexander Klimetschek wrote:
> On Thu, Feb 26, 2009 at 4:42 PM, Akil Ali <Akil.Ajani@cognizant.com>
> wrote:
>> Sorry sir i dont have the information that NODE D is under A/B/C. so 
>> how to get the NODE object of NODE D. without prior knowledge that D 
>> is under A/B/C.
> Well, you could either navigate to it by looking for whatever marks 
> that node as "D" (properties, node type, node name) or do the same 
> with an xpath query. Typically it has a node type, let's say 
> "my:dtype", so the query would be:
> //element(*, my:dtype)
> This gives you all nodes of type "my:dtype". If you have some 
> additional property you want to check for, you can do this:
> //element(*, my:dtype)[@myprop='foobar']
> which gives you all my:dtype nodes with a property set to the value 
> "foobar".
> Regards,
> Alex
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com

View this message in context:
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

View raw message