Re: [xml] SelectSingleNode
- From: "Paul B. Cameron" <paul b cameron kepware com>
- To: <xml gnome org>
- Subject: Re: [xml] SelectSingleNode
- Date: Tue, 3 May 2011 12:32:11 -0400
Thank you for your reply, Daniel. Putting the namespace issue aside (I can
work around this, as you suggest), I do have another related question. It is
probably a bit naïve, so please bear with me.
To implement something similar to SelectSingleNode, I am taking an input
xmlNodePtr (element) and using it to build an XPath expression using the
parent\child link, i.e. so the result is something like
"\root\child\grandchild". I pass this to xmlXPathEvalExpression, retrieve
the node I want and return a copy of that node using xmlCopyNode.
However, since xmlCopyNode does not populate the parent member of the copy I
can't use it in future calls to SelectSingleNode, because it won't be able
to generate the XPath expression properly.
I assume it is not wise to simply populate the parent member of the copy
using the original node that was passed into my function. Is there a way to
'find' the DOM node that matches a node returned by an XPath query? Am I
going about the whole thing wrong?
Thanks,
- Paul
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]