<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>How to optimize xpath in jdom</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2995" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=642592515-07122006><FONT face=Arial
color=#0000ff size=2>You might find that Saxon (which is able to read JDOM as an
input document) does a better job of this. In particular, Saxon-SA will build an
index to support this kind of expression.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=642592515-07122006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=642592515-07122006><FONT face=Arial
color=#0000ff size=2>Michael Kay</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=642592515-07122006><FONT face=Arial
color=#0000ff size=2>http://www.saxonica.com/</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> jdom-interest-bounces@jdom.org
[mailto:jdom-interest-bounces@jdom.org] <B>On Behalf Of </B>Deepa
Chandrashekaraiah (RBIN/EDM2)<BR><B>Sent:</B> 07 December 2006
11:37<BR><B>To:</B> jdom-interest@jdom.org<BR><B>Subject:</B> [jdom-interest]
How to optimize xpath in jdom<BR></FONT><BR></DIV>
<DIV></DIV><!-- Converted from text/rtf format -->
<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></BLOCKQUOTE></BODY></HTML>