Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Need help to extract node using JAVA Xpath

From: Martin Honnen <mahotrash@-----.-->
To: 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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent