You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Orlando Conetta <or...@sharpbox.com> on 2012/06/21 12:08:54 UTC

[jxpath] Walk the path.

Dear Group.



Firstly, I have been using JXPath for over two years and am very grateful
for what is a wonderful tool.



I do have one question though. I currently use XPath to navigate a Java
Bean object graph, where each object implements a Map. However, I now need
to be able to calculate the interdependencies between different expressions
against an object graph.



For example, in the case of the path:



/foo/bar/tomorrow = 1 and /foo/two/three = 0



I would, ideally, like to be able to be able to make a call that returns
the object for each axis of each expression. And so would return an array
of Pointers for: [ foo, bar, tomorrow, two, three]



However, I suspect there is no utility class to do this, and was hoping I
could gain access to the parse tree for an expression and then walk each
axis of each path myself. However, I cannot see a way of doing this either,
or if it is at all possible?



Once again, thank you for this library, and I should be in your debt for
any assistance that can be provided.



Kind regards.

Orlando.

RE: [jxpath] Walk the path.

Posted by Martin Gainty <mg...@hotmail.com>.
start with DefaultNavigator selecting the Iterator that most closely works for the level you need to work with
calculate  the delta(s) as necessary

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


> From: orlando.conetta@sharpbox.com
> Date: Thu, 21 Jun 2012 11:08:54 +0100
> Subject: [jxpath] Walk the path.
> To: user@commons.apache.org
> 
> Dear Group.
> 
> 
> 
> Firstly, I have been using JXPath for over two years and am very grateful
> for what is a wonderful tool.
> 
> 
> 
> I do have one question though. I currently use XPath to navigate a Java
> Bean object graph, where each object implements a Map. However, I now need
> to be able to calculate the interdependencies between different expressions
> against an object graph.
> 
> 
> 
> For example, in the case of the path:
> 
> 
> 
> /foo/bar/tomorrow = 1 and /foo/two/three = 0
> 
> 
> 
> I would, ideally, like to be able to be able to make a call that returns
> the object for each axis of each expression. And so would return an array
> of Pointers for: [ foo, bar, tomorrow, two, three]
> 
> 
> 
> However, I suspect there is no utility class to do this, and was hoping I
> could gain access to the parse tree for an expression and then walk each
> axis of each path myself. However, I cannot see a way of doing this either,
> or if it is at all possible?
> 
> 
> 
> Once again, thank you for this library, and I should be in your debt for
> any assistance that can be provided.
> 
> 
> 
> Kind regards.
> 
> Orlando.