<!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">
I wonder if the NPE is really thrown from the method (which I don't
believe).<br>
If you realize that the NPE exception was actually thrown because you
tried to call a method of a "null" object you should again look at your
code, at the JDOM javadocs etc.<br>
<br>
Anand, Rajesh wrote:
<blockquote
cite="mid965DC1D036BF2244BEB424A3645D186A12E9CDF0@mllna201mb.emea.win.ml.com"
type="cite">
<title>Message</title>
<meta http-equiv="Content-Type" content="text/html; ">
<meta content="MSHTML 6.00.2900.2627" name="GENERATOR">
<div><span class="457153410-23062005"><font color="#0000ff"
face="Arial" size="2"> Sorry, that was a typo...</font></span></div>
<div><span class="457153410-23062005"></span> </div>
<div><span class="457153410-23062005"> <font color="#0000ff"
face="Arial" size="2">it should be...</font></span></div>
<div><span class="457153410-23062005"></span> </div>
<div><span class="457153410-23062005"><font face="Arial" size="2"><strong>
Line1 - Element childelem1 = element.getChild("ClosingPrice",
element.getNamespace());</strong><font face="Times New Roman" size="3">
<br>
<b> </b><br>
</font><b><font face="Times New Roman" size="3"> </font><font
face="Arial" size="2">Line 2 -String date[x] =
childelem1.getTextTrim();</font></b><font face="Times New Roman"
size="3"> </font></font></span></div>
<div><span class="457153410-23062005"><strong></strong></span> </div>
<div><span class="457153410-23062005"> <strong><font face="Arial"
size="2">regards,</font></strong></span></div>
<div> </div>
<div> </div>
<!-- Converted from text/rtf format -->
<p><span lang="en-gb"><b><i><font face="Arial" size="2">Rajesh Anand</font></i></b></span>
<br>
<span lang="en-gb"><b><font face="Arial" size="2">Tel: + (44) (0) 207
996 1152</font></b></span> <br>
<span lang="en-gb"><b><font face="Arial" size="2">Mob: + (44) (0)
7947273151</font></b></span> <br>
<span lang="en-gb"><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></span>
</p>
<blockquote style="margin-right: 0px;" dir="ltr">
<div class="OutlookMessageHeader" align="left" dir="ltr"
lang="en-us"><font face="Tahoma" size="2">-----Original Message-----<br>
<b>From:</b> Victor Toni [<a class="moz-txt-link-freetext" href="mailto:victor.toni@ebuconnect.de">mailto:victor.toni@ebuconnect.de</a>] <br>
<b>Sent:</b> 23 June 2005 11:33<br>
<b>To:</b> Anand, Rajesh<br>
<b>Subject:</b> Re: [jdom-interest] Null Pointer Exception from
getTextTrim() method<br>
<br>
</font></div>
Maybe you should take a closer look at the names of your variables.<br>
Usually one would use some breakpoints, logging messages, etc. before
saying something like:<br>
<br>
My loop doesn't work with JDOM. <br>
Here is my code snippet:<br>
<br>
while(false) {<br>
// some JDOM stuff<br>
}<br>
<br>
<br>
Anand, Rajesh wrote:
<blockquote
cite="mid965DC1D036BF2244BEB424A3645D186A12E9CDEE@mllna201mb.emea.win.ml.com"
type="cite">
<meta content="MS Exchange Server version 6.0.6603.0"
name="Generator">
<div><!-- Converted from text/rtf format -->
<p> <font face="Arial" size="2">Folks,</font> </p>
<p> <font face="Arial" size="2">here is my code snippet….</font>
</p>
<p> <b> <font face="Arial" size="2">Line1 - Element
childelem2 = element.getChild("ClosingPrice", element.getNamespace());</font></b>
<br>
<b> </b><br>
<b> <font face="Arial" size="2">Line 2 -String date[x] =
childelem1.getTextTrim();</font></b> </p>
<p> <font face="Arial" size="2">and here is the part of
XML I'm trying to read…</font> </p>
<p> <b> <font face="Times New Roman"><getIndex:Price>
</font></b><br>
<b> <font face="Times New Roman"><getIndex:PriceEffectiveDate>2005-05-10</getIndex:PriceEffectiveDate>
</font></b><br>
<b> <font face="Times New Roman"><getIndex:ClosingPrice>2.99</getIndex:ClosingPrice>
</font></b><br>
<b> <font face="Times New Roman"></getIndex:Price></font></b>
</p>
<p> <font face="Arial" size="2">So, why is the 2nd line
giving me Null Pointer error instead of returning a value of "2.99"??</font>
</p>
<p> <font face="Arial" size="2">Any helps will be greatly
appreciated.</font> </p>
<p><b><i><font face="Arial" size="2">Rajesh Anand</font></i></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>
</blockquote>
</blockquote>
</body>
</html>