Re: [xml] Regarding xmlTextReaderNext Api



On Wed, Jun 25, 2008 at 05:34:25PM +0800, Ashwin wrote:
Hi,
 
  Hi Ashwin,

 first sorry, i have lot of backlog, there is a lot of questions or reports
from you in my XML folder that i didn't replied to yet. They are marked
unread so i will get to them at some point.

I am parsing using the reader walker Api's. While walking the tree I need to
skip the subtree for a certain element, I tried to use the xmlTextReaderNext
API, however it is returning me an erroneous result, it returns me the child
node of the element whose subtree I want to skip.

This happens because in case of a preparsed document a different set of
Api's are called 

if (reader->doc != NULL)

        return(xmlTextReaderNextTree(reader)); ------> This API too should
effectively skip the sub-tree, but it does not.

  ah, then it's a bug. i have tried to make sure the reader and the walker
work the same, but i think I didn't tried that extensively for extra
functionality like skipping part of the tree.
  Can you see why xmlTextReaderNextTree doesn't work, it seems it should
do what is expected, i don't really see why not.

If however I create a reader using xmlReaderForMemory then the functionality
is fine, as it goes to the following part of the code in xmlTextReaderNext

do {

        ret = xmlTextReaderRead(reader);

            if (ret != 1)

                return(ret);

} while (reader->node != cur);

And returns the node after skipping the sub-tree.

  yes that's the expected behaviour,

Is this a usage issue or a problem with the implementation of
xmlTextReaderNextTree Api, which is invoked in the case of pre-parsed
documents.

  yes i think so,

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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