K
Kaidi
Hello!
I am using Document and DOM to hold a XML file, and make some changes
to the Document. After that, I just wonder is there any easy way to
write the modified XML file back to disk? (loop all the nodes and
print them out is one way of course, any other better way?)
The piece of node is:
String filename="mytest.xml";
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
// Create the builder and parse the file
Document doc = factory.newDocumentBuilder().parse(new
File(filename));
// changes the doc, add, edit nodes, etc.
Now, I want to get the updated xml file from "doc", what to do?
Anything like doc.writeAsXMLFile("newFile.xml")?
Thanks and happy holiday.
I am using Document and DOM to hold a XML file, and make some changes
to the Document. After that, I just wonder is there any easy way to
write the modified XML file back to disk? (loop all the nodes and
print them out is one way of course, any other better way?)
The piece of node is:
String filename="mytest.xml";
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
// Create the builder and parse the file
Document doc = factory.newDocumentBuilder().parse(new
File(filename));
// changes the doc, add, edit nodes, etc.
Now, I want to get the updated xml file from "doc", what to do?
Anything like doc.writeAsXMLFile("newFile.xml")?
Thanks and happy holiday.