Re: [xml] xmlTextReaderNext skipping nodes



Attached is a patch for this. Testing for the XML_TEXTREADER_BACKTRACK state is correct.

Rob

Rob Richards wrote:

Ran into an issue when positioned at the end of an element, calling xmlTextReaderNext does not return the next node. This seems to only happen if the previous node had children and were traversed. I am not exactly sure of the states, but it looks like within xmlTextReaderNext, the XML_TEXTREADER_BACKTRACK state is not checked - as it looks like this is set if the node's children had been traversed and the end of the node has been hit.

Index: xmlreader.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/xmlreader.c,v
retrieving revision 1.116
diff -c -r1.116 xmlreader.c
*** xmlreader.c 18 Feb 2005 19:36:12 -0000      1.116
--- xmlreader.c 10 Mar 2005 11:25:51 -0000
***************
*** 1589,1595 ****
      cur = reader->node;
      if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE))
          return(xmlTextReaderRead(reader));
!     if (reader->state == XML_TEXTREADER_END)
          return(xmlTextReaderRead(reader));
      if (cur->extra & NODE_IS_EMPTY)
          return(xmlTextReaderRead(reader));
--- 1589,1595 ----
      cur = reader->node;
      if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE))
          return(xmlTextReaderRead(reader));
!     if (reader->state == XML_TEXTREADER_END || reader->state == XML_TEXTREADER_BACKTRACK)
          return(xmlTextReaderRead(reader));
      if (cur->extra & NODE_IS_EMPTY)
          return(xmlTextReaderRead(reader));


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