How to finding the entire path of a value? XPath?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Adnan_Umar
Posted On:   Wednesday, July 23, 2003 01:49 PM

Alchimiste Suppose we have the following XML document: Paulo Coelho Coffragants Inc XML Design Bonneau Wrox System Arch. with XML Daum MK and we run the XPath "\Authror", we get.. Paulo Coelho Bonneau Daum Is it possible to find the entire path using XPath or something else? such as.. BooksGeneralAuthorPaulo Coelho BooksStandardsXMLAuthorBonneau BooksStandardsXMLAuthorDa   More>>
Alchimiste

Suppose we have the following XML document:




			






Paulo Coelho

Coffragants Inc







XML Design

Bonneau

Wrox





System Arch. with XML

Daum

MK










and we run the XPath "\Authror", we get..



			
Paulo Coelho

Bonneau

Daum




Is it possible to find the entire path using XPath or something else? such as..



			
BooksGeneralAuthorPaulo Coelho

BooksStandardsXMLAuthorBonneau

BooksStandardsXMLAuthorDaum




Thank you in advance..
   <<Less

Try JDom

Posted By:   Roger_Hand  
Posted On:   Thursday, July 24, 2003 12:56 PM

Dunno if this is the easiest way, but this should be possible using JDom, which I highly recommend for doing this sort of thing. (Click on Documentation and read the Oracle Magazine articles for a good starting overview.)


It's a bit roundabout, but once you've gotten your nodes using XPath.selectNodes() you could have a little routine for each element that makes recursive calls to element.getParent().


I have not tested this and, again, there may be an easier way of doing this. Good luck!

About | Sitemap | Contact