hi all,

I'm having trouble with DTM node handles. I have two Document structures -- A and B -- on which I am computing a union. I am implementing the union by importing nodes from B into A, via Document#importNode. The trouble is that I am getting the following exception when executing an XPath on the resulting structure -- thrown when 'contextNode' in the code snippet below is an imported node:

java.lang.RuntimeException: Could not resolve the node to a handle
at org.apache.xml.dtm.ref.DTMManagerDefault.getDTMHandleFromNode(DTMManagerDefault.java:625) at org.apache.xpath.XPathContext.getDTMHandleFromNode(XPathContext.java:220)
...

The code I'm using the execute a (pre-compiled) XPath is:

xpath.execute(
xpathSupport, xpathSupport.getDTMHandleFromNode( contextNode ), prefixResolver
       );

where 'prefixResolver' and 'xpathSupport' are cached objects. I basically have something like CachedXPathAPI set up, except the XPath objects are pre-compiled. I'm new to this package, and I have a feeling I'm doing something fundamentally wrong. I'd assume that the #importNode method would take care of the details, but maybe that doesn't even make sense ... Is there a standard way to clean up the DTM after modifying a structure? In the archive I've seen references to "use a new DOMSource", but from the APIs I can't make sense of the specifics. I'm guessing that's equivalent to re-loading the entire structure...
[0] seems to be similar, but I don't know if it's related.

Any help would be greatly appreciated,

Brien

[0] http://www.mail-archive.com/[email protected]/msg06880.html


-----
I am using the xpath package included in JDK 1.4.2_08

Reply via email to