Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Need help to extract node using JAVA Xpath [Thread Next] Re: Need help to extract node using JAVA XpathTo: NULL Date: 6/5/2007 5:17:00 PM brahatha wrote: > So final result should be like this, > > Attempt 1: > <NodeIwant nodeName="conf" noFail="1"> > <NodeIwant nodeName="nconf" noFail="0"> > Attempt 2: > <NodeIwant nodeName="xyz" noFail="0"> XPath 1.0 selects nodes in a document, it does not change them. Thus if you select a NodeIwant element node in the XML sample you posted then it continues to have its child nodes like those Data elements. If you only need the NodeIwant elements without their child nodes then you need an XSLT transformation. As for the XPath /RootElement/colAttempt/*[starts-with(name(), 'Attempt')]/ResultElement/nodeList/NodeIwant should do to select all those NodeIwant elements, if you want to do it in two steps then first select /RootElement/colAttempt/Attempt1 and /RootElement/colAttempt/Attempt2 and then relative to that ResultElement/nodeList/NodeIwant -- Martin Honnen http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
