Hi Alice,

There is no "standard solution," because it depends on what kind of object
your XPath expression returns.  If it's node set, the set will contain
nodes in the source tree you passed into the evalution.  All you need to do
in that case is copy the node set, or copy the pointers out of the node
set.  If your expression evaluates to a boolean, string, or number, you can
just make a copy of the value.

NodeRefList  nodeSet = xobjectPtr.nodeset();
XalanDOMString str = xobjectPtr.str();
...

At any rate, you must make sure the XObjectPtr instance is not in scope
when the XPathEvaluator instance is destroyed, or when the next evaluation
occurs.

Dave



                                                                                
                                                       
                      [EMAIL PROTECTED]                                         
                                                        
                      k                        To:      
[email protected]                                                   
                                               cc:      (bcc: David N 
Bertoni/Cambridge/IBM)                                           
                      12/06/2003 11:30         Subject: Begginer question: 
Xalan XObjectPtr and evaluate                               
                      PM                                                        
                                                       
                                                                                
                                                       



Hi,
I'm new to Xalan and this list...

I am using xalan's xpath api, and i want to return a XObjectPtr from my
function, but then, when i evaluate again, the app crashes, I read
somewhere that the XObjectPtr should not exist if the XPathEvaluator
doesn't exist anymore, or a new evaluation accurs, but what should i do in
this case? Is there a 'standart solution'?

And another question is what should i excpect to get from evaluate if the
evaluated xpath doesn't exist in a doc (or simply, how can i check if
something exists in my xml document?)

Thanks.
Alice.



Reply via email to