views:

102

answers:

2

Hi, I have created XML file for a Blackberry application ,and I have used

root.getFirstChild().setNodeValue("ABCDE");

to set the node value.

An exception is thrown while adding node value.

What can be done?

PLease help.

Thanks in advance.

A: 

I suspect (in the absence) of any info, that the getFirstChild() method is not returning what you think it is (a text node?), but rather something else. I would inspect the node returned (cast appropriately) and work from there.

Brian Agnew
A: 

DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory .newDocumentBuilder(); document = documentBuilder.newDocument(); root = document.createElement("START"); document.appendChild(root);

//After this,I am trying to set the node value:

root.getFirstChild().setNodeValue("ABCDE");

imMobile
I think you should edit the question rather than post further info further down the (albeit small) thread
Brian Agnew
Okies...please help regarding setting the node values...really stuck
imMobile