I am porting code that was previously working with
the previous TinyXPath version. The following does
not work anymore :
- doing a query
- getting back a nodeset
- storing nodes ( using node->Clone() )
- doing other queries on these "new" nodes
I took a look at the code, the problem arise because
it seems that the cloned nodes (or the ones returned
in the nodeset ?) do not have a parent (Parent()
returns NULL) then it raises the 'execution error'
exception in er_compute_xpath in xpath_processor.cpp
Before it was ok because of the "build_root" thing.
Can someone help me please ?
I do not know what to do.
Thanks in advance!!!
Would you have an example of this?
The code has been changed indeed, so that we do not touch the XML tree anymore.
All returned nodes should still have their parent: we do not clone them anymore. We return pointers to the untouched original XML.
I think I found my problem : in fact, as you do not
touch the XML tree and you return pointers to the
nodes now, I do not need to clone the nodes in the
returned nodeset after a query.
All the returned nodes in a nodeset are valid as
long as the XML document is there. It seems it was
not the case before ?
Anyway, I did a test and it's fine again :-)
(without cloning anything !).