| Author |
Node searching with Xerces
|
Shashank Agarwal
Ranch Hand
Joined: May 20, 2004
Posts: 105
|
|
I'm trying to find a node in my XML document, but it should be within a specific parent. Here's what the XML looks like - Here, "Methods" is the main title, but "Western Blotting" is the subtitle. If I just want to capture the titles, then I'd want to look for "article/sec/title", but if I want only subtitles, I'd look for "articles/sec/sec/title". I'm using xerces. Here's what I've got - But this gets all the titles (including sub-titles). I tried replacing "title" with "article/sec/title" and "article::sec::title", but that just returns no nodes. Searched online, but didn't find anything.
|
 |
Yves Zoundi
Ranch Hand
Joined: Aug 31, 2008
Posts: 47
|
|
|
Have a look at the package javax.xml.xpath
|
Author of VFSJFileChooser and XPontus XML Editor
|
 |
Shashank Agarwal
Ranch Hand
Joined: May 20, 2004
Posts: 105
|
|
Thanks Yves!!! It worked. Just for anyone who has the same problem in future, here's the code that I used - Found the code off http://www.ibm.com/developerworks/library/x-javaxpathapi.html
|
 |
 |
|
|
subject: Node searching with Xerces
|
|
|