<!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">
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 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>Null Pointer Exception from getTextTrim() method</title>
<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>
</body>
</html>