public void setNodeValue(String xpath, Object value) throws XmlException { xpath = initXPathNamespaces(xpath); XmlCursor cursor = xmlObject.newCursor(); try { cursor.selectPath(xpath); if (cursor.toNextSelection()) { XmlUtils.setNodeValue(cursor.getDomNode(), value == null ? null : value.toString()); } } finally { cursor.dispose(); } }