*** xmlReader.c 2008-07-01 23:25:28.000000000 -0700 --- xmlReaderfix.c 2008-07-02 12:56:30.459389272 -0700 *************** xmlTextReaderNextTree(xmlTextReaderPtr r *** 1847,1863 **** } if (reader->state != XML_TEXTREADER_BACKTRACK) { ! if (reader->node->children != 0) { ! reader->node = reader->node->children; ! reader->depth++; reader->state = XML_TEXTREADER_START; return(1); } ! if ((reader->node->type == XML_ELEMENT_NODE) || (reader->node->type == XML_ATTRIBUTE_NODE)) { reader->state = XML_TEXTREADER_BACKTRACK; ! return(1); } } --- 1847,1868 ---- } if (reader->state != XML_TEXTREADER_BACKTRACK) { ! /* Here removed traversal to child, because we want to skip the subtree, ! replace with traversal to sibling to skip subtree */ ! if (reader->node->next != 0) { ! reader->node = reader->node->next;// Move to sibling if present,skipping sub-tree ! //reader->depth++; reader->state = XML_TEXTREADER_START; return(1); } ! ! /* if reader->node->next is NULL mean no subtree for current node, ! so need to move to sibling of parent node if present */ if ((reader->node->type == XML_ELEMENT_NODE) || (reader->node->type == XML_ATTRIBUTE_NODE)) { reader->state = XML_TEXTREADER_BACKTRACK; ! xmlTextReaderRead(reader);// This will move to parent if present ! //return(xmlTextReaderReadTree(reader)); } } *************** xmlTextReaderNextTree(xmlTextReaderPtr r *** 1876,1882 **** reader->node = reader->node->parent; reader->depth--; reader->state = XML_TEXTREADER_BACKTRACK; ! return(1); } reader->state = XML_TEXTREADER_END; --- 1881,1888 ---- reader->node = reader->node->parent; reader->depth--; reader->state = XML_TEXTREADER_BACKTRACK; ! xmlTextReaderNextTree(reader); //Repeat process to move to sibling of parent node if present ! //return(1); } reader->state = XML_TEXTREADER_END;