[xml] Iterating over a node set


I'm trying to iterate over a node set using

xpath_items = xpath_obj->nodesetval->nodeTab

(xpath_obj is the one returned by xmlXPathCompiledEval(); xpath_items is an
xmlNodePtr). Now when I do

while ( *xpath_items ) {

on Linux, the loop terminates correctly (since xpath_items becomes NULL),
but on Solaris 2.8 (64 bit), the loop continues until an attribute is
accessed (the loop then terminates with a segfault). (I need to iterate over
the node set since it contains more than 1 node.) The libxml2 version
I'm using is 2.4.26. Two questions:

1. Is my way of iterating over a node set correct? If not, what am I doing
2. Has anything changed with respect to XPath handling from version 2.4.26
to the current version? (If so, I will upgrade).

Thanks in advance for any info!



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