Hi

If i use the XercesDOMSupport and XPathEvaluator class i am facing some
problems -
1. i get asserts saying "startNode1 != 0" and "startNode2 != 0"
2. if i change the document manually, it is not reflected in the evaluator.
if i do rebuildWrapper() i get asserts saying
"m_parentNavigatorStack.empty() == false" and
"m_siblingNavigatorStack.empty() == false" and then the application crashes
!

what is the correct way of using this? how can i keep the other helper
objects live till i access the return object?
i must say the documentation is not enough to let novices use the lib.

TIA
Jaspreet

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 29, 2003 11:42 PM
To: [email protected]
Subject: Re: xpath evaluation using xalan






> Hi All
>
> I am trying to evaluate an xpath expression using xalan. i'm using the
> xpathwrapper sample for this. i have a few questions -
>
> it seems that the parserLiason, envSupport, constructionContext,
> documentWrapper, wrapperNavigator, and all other classes that are used as
> glue code should be "live" when we access the return value (xobject). if
> these objects are destroyed, the xobject return value is invalidated.
> if i return the xobject to some other class and the above mentioned
objects
> are destroyed, i am unable to access the return value. so i've declared
> these as static. is this the way to use the lib?

Static would be a bad idea.  They do need to be "live", but they should be
wrapped up in some class or classes of your own devising that have the same
lifetime as the XObject instance.

> i get a lot of asserts while evaluating some expressions. the assertion
> looks like "node1.isIndexed() == true && node2.isIndexed() == true". I
can
> avoid the assertions by modifying the xpath expression. but in some cases
i
> just can't get rid of it. could you pls tell me the reason for this
assert?

I think you're misusing the library.  You should only use
XalanSourceTreeDOMSupport if you're using Xalan's default source tree
implementation.  It sounds like you're using one of the wrappers, so you
need to use XercesDOMSupport.

Look at the sample SimpleXPathAPI and use the XPathEvaluator class, rather
than using the code in XPathWrapper.cpp.  It has a higher level of
abstraction, and will make things a bit easier for you.

Dave

Reply via email to