<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Anand, Rajesh wrote:
<blockquote
cite="mid965DC1D036BF2244BEB424A3645D186A0C407B88@mllna201mb.emea.win.ml.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-16">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-16">
<meta http-equiv="Content-Type" content="text/html; ">
<meta name="Generator" content="MS Exchange Server version 6.0.6603.0">
<title>Jdom & Xpath error in IDE</title>
<div><!-- Converted from text/rtf format -->
<p> <b> <font face="Arial" size="2">Hi Folks,</font></b> </p>
<p><b> <font face="Arial" size="2">Here is my code snippet.</font></b>
</p>
<p><b> <font face="Arial" size="2">import org.jdom.Element;</font></b>
<br>
</p>
</div>
</blockquote>
import org.jdom.JDOMException; // maybe this one helps you<br>
<blockquote
cite="mid965DC1D036BF2244BEB424A3645D186A0C407B88@mllna201mb.emea.win.ml.com"
type="cite">
<div>
<p><b> <font face="Arial" size="2">import
org.jdom.xpath.XPath;</font></b> <br>
<b> <font face="Arial" size="2">import org.w3c.dom.Document;</font></b>
<br>
<b> <font face="Arial" size="2">import
org.xml.sax.SAXException;</font></b> <br>
<b> </b> <br>
<b> <font face="Arial" size="2">try {</font></b> <br>
<b> <font face="Arial" size="2">Document doc =
parseXmlFile(args[2], false);</font></b> <br>
<b> </b> <br>
<b> <font face="Arial" size="2">XPath
xpath =
XPath.newInstance("/Envelope/Body/IndexServiceRequest/BeginDate");</font></b>
<br>
<b> </b> <br>
<b> <font face="Arial" size="2">Element
ele = (Element) xpath.selectSingleNode(doc);</font></b> <br>
<b> </b> <br>
<b> <font face="Arial" size="2">if(ele
!= null){</font></b> <br>
<b> </b> <br>
<b> <font face="Arial"
size="2">ele.setText(args[0]);</font></b> <br>
<b> </b> <br>
<b> <font face="Arial" size="2">} </font></b>
<br>
<b> </b> <br>
<b> <font face="Arial" size="2">GetIndexService
pf = new GetIndexService();</font></b> <br>
<b> </b> <br>
<b> <font face="Arial" size="2">pf.url
= new URL(s);</font></b> <br>
<b> </b> <br>
<b> <font face="Arial" size="2">pf.submitData();</font></b>
<br>
<b> </b> <br>
<b> <font face="Arial" size="2">}</font></b> <br>
<b> <font face="Arial" size="2">catch
(MalformedURLException e) {</font></b> <br>
<b> </b> <br>
<b> <font face="Arial" size="2">System.err.println(args[0]
+ "is not a URL I understand") ;</font></b> <br>
<b> <font face="Arial" size="2">} </font></b>
<br>
<b> <u> <font face="Arial" size="2">catch
(JDOMException e){</font></u></b> <br>
<b> </b> <br>
<b> <font face="Arial" size="2">}</font></b> <br>
<b> </b> </p>
<p><b> <font face="Arial" size="2">The problem is that the
IDE complains that "JDOM exception cannot be resolved".</font></b> </p>
<p><b> <font face="Arial" size="2">However, if I remove the
JDOMException , then the IDE complains - "Unhandled exception type
JDOM".</font></b> </p>
<p><b> <font face="Arial" size="2">Can someone please help.</font></b>
</p>
<p><b> <font face="Arial" size="2">Thanks in advance.</font></b>
</p>
<p><b><i><font face="Arial" size="2">Rajesh Anand</font></i></b> <br>
<b><font face="Arial" size="2">Tel: + (44) (0) 207 996 1152</font></b>
<br>
<b><font face="Arial" size="2">Mob: + (44) (0) 7947273151</font></b> <br>
<b><font face="Arial" size="2"><a class="moz-txt-link-freetext"
href="Email:Rajesh_anand@ml.com">Email:Rajesh_anand@ml.com</a></font></b>
</p>
</div>
<div>
<hr color="gray"> </div>
<div>If you are not an intended recipient of this e-mail, please
notify the sender, delete it and do not read, act upon, print,
disclose, copy, retain or redistribute it. <a
href="http://www.ml.com/email_terms/">Click here </a>for important
additional terms relating to this e-mail. <a
href="http://www.ml.com/email_terms/">http://www.ml.com/email_terms/</a></div>
<div>
<hr color="gray"> </div>
<pre wrap=""><hr size="4" width="90%">
_______________________________________________
To control your jdom-interest membership:
<a class="moz-txt-link-freetext"
href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com</a></pre>
</blockquote>
</body>
</html>