Y
ysongpsu
I searched the forum and see lots of examples, but I'm still confused.
I'm using DOM.
Say I've got an "a.xml" file, and have two methods, updateXML() that
updates an existing record, and insertXML() that inserts into this
file.
Anybody can give me a hint how to implement these two functions?
How to write back to the file? I've learned how to read it:
InputStream aXML = getResourceAsStream("a.xml");
DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(aXML);
doc.getDocumentElement().normalize();
NodeList nodeLst = doc.getElementsByTagName("record");
Thanks a lot.
I'm using DOM.
Say I've got an "a.xml" file, and have two methods, updateXML() that
updates an existing record, and insertXML() that inserts into this
file.
Anybody can give me a hint how to implement these two functions?
How to write back to the file? I've learned how to read it:
InputStream aXML = getResourceAsStream("a.xml");
DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(aXML);
doc.getDocumentElement().normalize();
NodeList nodeLst = doc.getElementsByTagName("record");
Thanks a lot.