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 ! :-)