0

Hey guys,

I am writing a desktop app to interact with XML. It reads the XML fine using the DocumentBuilderFactory, but when I try to save any changed to the XML file (e.g. setNodeValue()) the changes do not save.

As an example here is some code I tried, just to remove a node:

Element root = d.getDocumentElement();
            Node child = (Node)root.getFirstChild();
            root.removeChild(child);

where d is the document object.

XML looks like the following:

<root>
	<options> 
			<node1 name="blah" nodeName="blah2" />    
	</options>	
	<others>
		<dir>
				<dir name="pathname" type="run" />
		</dir>
	</others>
</root>

Any help is appreciated.

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by sillyboy
0

Cheers, I am fairly sure your suggestion is what I need. Thought it was something like that.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.