I tried to change the content of the attribute in the xml using DOM.Its throwing nullpointer exception...
This is my xml:
Suraj Berwal
Greenhorn
Joined: Dec 28, 2001
Posts: 25
posted
0
The problem is you are not using the Document class instance you have created in second line of your main method.
You are creating a new instance of Document class in the changeData() method.
You need to pass the object of the Document class to the changeData() method in your main method. Modify your change Data() method to accpet the Document object in its parameters.
Try and see if it works. Post your output if it doesn't work.
Thanks, Suraj
shalini gnana
Ranch Hand
Joined: Sep 18, 2007
Posts: 189
posted
0
Its no throwing any error,now... But the attribute "value1" is not changing into newValue1..
Thank you...
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
1
posted
0
But the attribute "value1" is not changing into newValue1..
Where are you looking? The original file won't be changed unless you write over it - there is no magic link between the DOM and the text file.