<HTML>
<HEAD>
<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; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.6603.0">
<TITLE>Null Pointer Exception from getTextTrim() method</TITLE>
</HEAD>
<BODY >
<DIV>
<!-- Converted from text/rtf format -->
<P> <FONT SIZE=2 FACE="Arial">Folks,</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">here is my code snippet….</FONT>
</P>
<P> <B> <FONT SIZE=2 FACE="Arial">Line1 - Element childelem2 = element.getChild("ClosingPrice", element.getNamespace());</FONT></B>
<BR><B> </B>
<BR><B> <FONT SIZE=2 FACE="Arial">Line 2 -String date[x] = childelem1.getTextTrim();</FONT></B>
</P>
<P> <FONT SIZE=2 FACE="Arial">and here is the part of XML I'm trying to read…</FONT>
</P>
<P> <B></B><B></B><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 SIZE=2 FACE="Arial">So, why is the 2nd line giving me Null Pointer error instead of returning a value of "2.99"??</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">Any helps will be greatly appreciated.</FONT>
</P>
<P><B><I><FONT SIZE=2 FACE="Arial">Rajesh Anand</FONT></I></B>
<BR><B><FONT SIZE=2 FACE="Arial">Email:Rajesh_anand@ml.com</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></BODY></HTML>