Skip to Content
0
Former Member
Nov 08, 2007 at 02:54 AM

XML parsing error in portal application...

15 Views

Hello,

I have this exception java.lang.NullPointerException# with a xml like this

<users><user><email></email></user></users>

When email is filled like this it's worked but when it is empty no...

test@test.com

The code is like this :

NodeList EmailList = firstPersonElement.getElementsByTagName("email");

Element EmailElement = (Element)EmailList.item(0);

NodeList textEmailList = EmailElement.getChildNodes();

if (textEmailList == null)

{

System.err.println("null !");

}

String Email = null;

Email = ((Node)textEmailList.item(0)).getNodeValue().trim();

System.err.println("Email : " + Email);

How can I resolve it ?

Thanks a lot

best regards