<!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>
&nbsp;&nbsp;&nbsp; // 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Arial" size="2">Folks,</font>
  </p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Arial" size="2">here is my code snippet&#8230;.</font>
  </p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b> <font face="Arial" size="2">Line1 - Element childelem2
= element.getChild("ClosingPrice", element.getNamespace());</font></b>
  <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </b>
  <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Arial" size="2">Line 2 -String date[x] =&nbsp;
childelem1.getTextTrim();</font></b>
  </p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Arial" size="2">and here is the part of XML
I'm trying to read&#8230;</font>
  </p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b> <font face="Times New Roman">&lt;getIndex:Price&gt; </font></b>
  <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Times New Roman">&lt;getIndex:PriceEffectiveDate&gt;2005-05-10&lt;/getIndex:PriceEffectiveDate&gt;
  </font></b><br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Times New Roman">&lt;getIndex:ClosingPrice&gt;2.99&lt;/getIndex:ClosingPrice&gt;
  </font></b><br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Times New Roman">&lt;/getIndex:Price&gt;</font></b>
  </p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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.&nbsp;&nbsp;&nbsp;&nbsp; <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>