Trying to use a org.w3c.dom.Node as the context node for a call to Document.evaluate (xpath).
Have to call toString on Node object before the Node object can be used as an argument to JSObject.call.
Please see the code summary, all works as expected once you call contextNode.toString().
The Document.evaluate method complains about an invalid context node if you dont call toString.
Summary of code:
Document doc= webView.getEngine().getDocument();
Node contextNode= doc.getDocumentElement();
// contextNode.toString()
JSObject jsdoc= (JSObject) doc;
jsdoc.call("evaluate", "//*" , contextNode, null, 9, null);
Exception thrown:
NOT_SUPPORTED_ERR: DOM Exception 9
Possible reason:
The debugger shows the field jsPeer is set to something else than 0 after the call to Node.toString()
Expected behavior:
No need for calling toString before you are able to use the contextNode.
Have to call toString on Node object before the Node object can be used as an argument to JSObject.call.
Please see the code summary, all works as expected once you call contextNode.toString().
The Document.evaluate method complains about an invalid context node if you dont call toString.
Summary of code:
Document doc= webView.getEngine().getDocument();
Node contextNode= doc.getDocumentElement();
// contextNode.toString()
JSObject jsdoc= (JSObject) doc;
jsdoc.call("evaluate", "//*" , contextNode, null, 9, null);
Exception thrown:
NOT_SUPPORTED_ERR: DOM Exception 9
Possible reason:
The debugger shows the field jsPeer is set to something else than 0 after the call to Node.toString()
Expected behavior:
No need for calling toString before you are able to use the contextNode.