Hi, Dave.

"Dave Brosius" <[EMAIL PROTECTED]> wrote on 2008-02-09 09:14:28 AM:
> Thank you Henry, that worked. (i don't have it in endorsed, btw) But
> having done that it still results in a NullPtrException the same as 
> when i used new XPatchFactoryImpl, here
> 
[HZ:  Snipped sample]
> 
> AxesWalker.setRoot(int) line: 221 
> WalkingIterator.setRoot(int, Object) line: 157 
> XNodeSet(NodeSequence).setRoot(int, Object) line: 265 
> WalkingIterator(LocPathIterator).execute(XPathContext) line: 212 
> XPath.execute(XPathContext, int, PrefixResolver) line: 337 
> XPath.execute(XPathContext, Node, PrefixResolver) line: 303 
> XPathImpl.eval(String, Object) line: 216 
> XPathImpl.evaluate(String, Object, QName) line: 281 
> ExtensionsWithXPath.exfunc(ExpressionContext) line: 28 
[HZ:  Trimmed stack trace]

I think the root of the problem is that XPathImpl.eval(String,Object) is 
creating a new XPathContext object in which to evaluate the path 
expression.  That would be OK if the processor were evaluating the 
expression against some vanilla DOM Node, but in fact, the context node in 
this case is an instance of DTMNodeProxy.

In XPath.execute(XPathContext,Node,PrefixResolver), the processor asks for 
a DTM node handle (an int) for the Node.  If this were an ordinary DOM 
Node, a new instance of DOM2DTM might be created, but as the Node is 
actually a DTMNodeProxy, it's simply asked for its node handle.  However, 
that node handle only makes sense in the original XPathContext that 
existed for evaluating the stylesheet; it doesn't make sense for the 
XPathContext created in XPathImpl.eval(String,Object), which will have its 
own set of potentially overlapping DTM node handles.

An appropriate fix might be for XPathImpl.eval(String,Object) to check 
whether Object is an instance of DTMNodeProxy, and then reuse the existing 
XPathContext - but I'm not sure whether you can get from the DTMNodeProxy 
to the containing XPathContext.  I can't check into it today, but if you 
have the inclination, that might give you something to go on.

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro
XML Transformation & Query Development
IBM Toronto Lab   T/L 313-6044;  Phone +1 905 413-6044
mailto:[EMAIL PROTECTED]

Reply via email to