Project

Profile

Help

DocumentWrapper#wrap

Added by Anonymous over 19 years ago

Legacy ID: #3017125 Legacy Poster: Yana Kadiyska (ykadiyska)

Hi, I get a lot of IllegalArgumentExceptions like this: java.lang.IllegalArgumentException: DocumentWrapper#wrap: supplied node does not belong to the wrapped DOM document at net.sf.saxon.dom.DocumentWrapper.wrap(DocumentWrapper.java:46) at net.sf.saxon.event.Builder.build(Builder.java:186) at net.sf.saxon.xpath.XPathEvaluator.setSource(XPathEvaluator.java:90) I am using Saxon v8.1.1 and it appears that the exception occurs whenever the DOMSource is constructed from a node which is not a document and has been disconnected from a document (e.g a reference obtained by calling removeChild()). Am I missing something...I did not see references to this in the bugs, sorry if it's something old. Thanks for your time


Replies (1)

RE: DocumentWrapper#wrap - Added by Anonymous over 19 years ago

Legacy ID: #3017178 Legacy Poster: Michael Kay (mhkay)

This restriction is documented in the API specification for DocumentWrapper#wrap; Saxon can only create a wrapper for a DOM tree that is rooted at a document node. Without this restriction, it would be very hard to enforce the XPath data model semantics that required nodes to have distinct identity and stable document order. Michael Kay

    (1-1/1)

    Please register to reply