Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
YamilBracho
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar
Accepted Solution

parsing an XML file

Hi. I am trying to parse an XML file via DOM. This process run with flying colors in another plataform so i just take the code as is and put it in my Blackberry project

I look for the children of element "data" (there are tow in the file, "key" and "datos") but in blackberry i got 0..!!!!

Enclosed a debug screen.

 

Is there a condition to check frst or something like that ?

Please use plain text.
Developer
YamilBracho
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: parsing an XML file

Oh, man, you can't believe this...!

My root element is "data", so I was doing this :

 

Element root = doc.getDocumentElement();

NodeList items = root.getElementsByTagName("data");
Node dataNode = items.item(0);
NodeList children = dataNode.getChildNodes();

 

And my code bombs in the dataNode...!!!!!

 

If i changed to :

NodeList items = doc.getElementsByTagName("data");

Node dataNode = items.item(0);
NodeList children = dataNode.getChildNodes();

 

now works fine..:!!!!

 

Another X file..!!!

Please use plain text.