You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Jaspreet Singh <Ja...@quark.com> on 2005/03/31 14:25:19 UTC

problem in multiple xpath executions

Hi

I use XPathEvaluator to create an XPath object using the createXPath
api. I use the evaluate method and pass this xpath object for execution.
i get the correct result.
I try evaluating again with the same xpath object and i get assertion
from xalanReferenceCountedObject saying m_recerenceCount should be 0.
the result evaluated is correct, though.

Any suggestions?


Thanks
Jaspreet

Re: problem in multiple xpath executions

Posted by da...@us.ibm.com.
> Hi 
> I use XPathEvaluator to create an XPath object using the createXPath 
api. I use
> the evaluate method and pass this xpath object for execution. i get the 
correct result.
> I try evaluating again with the same xpath object and i get assertion 
from
> xalanReferenceCountedObject saying m_recerenceCount should be 0. the 
result
> evaluated is correct, though.

Note that the documentation states:

        /**
         * Evaluate the supplied XPath expression, within the given 
context.  The
         * result is returned as a generalized object.  The object will be
         * destroyed when the returned when the user's copy of the 
returned
         * XObjectPtr goes out of scope, or when the XPathEvaluator goes 
out of scope
         * or another expression is evaluated.
         *
         * The user's XObjectPtr copy _must_ no longer be in scope when 
the XPathEvaluator
         * instance goes out of scope, or another expression is evaluated.

Note the last paragraph in particular.  I suspect you are keeping a copy 
of an XObjectPtr instance around from the previous evaluation.  If this 
doesn't cause your application to crash, you're lucky.

Dave