* @param value the value to set
* @param selectionNS the NamespacContext used to resolve namespaces during XPath evaluation
* @throws XMLException if an error occurred
*/
public static void setValue(Node node, String path, String value, NamespaceContext selectionNS) throws XMLException {
XPathExpression xp = createXPath(path);
// If we start from the document, we should take care of the XPath context
if(!xp.isFromRoot() && (node instanceof Document)) {
Document doc = (Document)node;
XPathContext ctx = s_parserDriver.getXPathContext(doc);
if(ctx!=null) {
// Ensure that the intermediate context are created
ctx.createNodes();
// And evaluate from this context
xp.setValue(ctx.getUniqueContextNode(),value,selectionNS,true);
return;
}
}
// Else, start from the current node
xp.setValue(node,value,selectionNS,true);
}