Update an XML node with Java and XPathAPI
Par Nicolas, lundi 16 juin 2008 à 17:14 :: General :: #481 :: rss
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 !
Commentaires
Aucun commentaire pour le moment.
Ajouter un commentaire
Les commentaires pour ce billet sont fermés.