lundi 16 juin 2008
Update an XML node with Java and XPathAPI
Par Nicolas, lundi 16 juin 2008 à 17:14 :: General
Once you have the Document object, and want to update a Node...
Element e = (Element) XPathAPI.selectSingleNode((Node) document.getDocumentElement(), xpath);
e.setTextContent(newValue);
That's it.
-> Might be smart to check that e is not null before trying to set the content !