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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.