Hi Deepa,<br>Perhaps you can use this:<br><br>import org.jdom.xpath.XPath<br>XPath xp = XPath.newInstance("/Root/Parent/Child[name=\"abc\"]/GrandChild");<br>xp.selectSingleNode(); or xp.valueOf(); <br><br>
Depends on what you want as output.<br><br>Note : you will have to include : jaxen-jdom.jar , saxpath.jar & jaxen-core.jar in addition to jdom.jar which you may have already added<br><br><div><span class="gmail_quote">
On 12/7/06, <b class="gmail_sendername">Deepa Chandrashekaraiah (RBIN/EDM2)</b> <<a href="mailto:Deepa.Chandrashekaraiah@in.bosch.com">Deepa.Chandrashekaraiah@in.bosch.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<p><font face="Arial" size="2">Hello,</font>
</p>
<p><font face="Arial" size="2">I am using Xpath available in jdom. The xml file is of 9MB size. It is taking a lot of time to query a simple xpath like:</font></p>
<p><font face="Arial" size="2">/Root/Parent/Child[name="abc"]/GrandChild</font>
</p>
<p><font face="Arial" size="2">I am trying to get the value of the "GrandChild" element in the following way:</font>
<br><font face="Arial" size="2">((Element)org.jdom.xpath.XPath.selectSingleNode(xml_Document, xpath_expression)).getValue();</font>
</p>
<p><font face="Arial" size="2">There are many "Child" elements in my huge xml file of 9MB size. Please let me know to optimize the xpath expression or any other workarounds.</font></p>
<p><font face="Arial" size="2">Thanks in advance.</font>
<br><font face="Arial" size="2">Regards,</font>
<br><font face="Arial" size="2">Chandra</font>
</p>
</div>
<br>_______________________________________________<br>To control your jdom-interest membership:<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com" target="_blank">
http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com</a><br><br></blockquote></div><br>