Re: [xml] XPath Question

On Thu, 2007-06-14 at 09:06 -0400, Glenn MacGregor wrote:
Hi All,
I am trying to libxml2 and the associated xpath to find nodes in the
following way:
where 'i' is 1 - last()
On the first time through (i == 1) this xpath returns al nodeset with
all //toplevel/secondlevel nodes. The second time (i == 2) it returns
an empty nodeset.
I need to get each secondlevel node, one at a time, is this xpath
correct, or is there some other way to do this?

Did you reset your context before the next iteration?

But more to the point, why iterate at the level of xpath eval? Why not
have xpath just return return all the second level nodes and iterate
through that list, that avoids unncecessary expensive xpath evaluations.

John Dennis <jdennis redhat com>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]