[xml] xmlTextReaderExpand still produces invalid Nodes



Hello,
 
the function xmlTextReaderExpand in xmlTextReader interface still produces invalid Nodes. I took the newest version 2.5.10. I have not tested this function for long time, because i took the SAX interface for reading my xml-file. The bug was first reported with number 117703 in version 2.5.7. I repeated now the test with the discribed processNode() function reported in the bug nr:117703  and a bit another xml-File.
 
the processNode function in testReader.c:
 
static void processNode(xmlTextReaderPtr reader)
{
     int type;
     xmlChar   *name=NULL;
     xmlNodePtr  node=NULL;
 
     type = xmlTextReaderNodeType(reader);
     name = xmlTextReaderName(reader);
   
     if (type == 1){     /*Expand only start Element*/
 
         if (strcmp(name,"bvclsadr")==0){  /*Expand only this Element*/
       
               node = xmlTextReaderExpand(reader);
               /*Print the Content*/
               printf("START printNode\n");
               printf("%s\n",xmlNodeGetContent(node));
               printf("END printNode\n");
               xmlTextReaderNext(reader);       /*Skip to next Element*/
          }
             elem++;
             attrs += xmlTextReaderAttributeCount(reader);
       
     }
     if(name!=NULL)
         xmlFree(name);
}
 
the xml-File:
 
<?xml version="1.0"?>
<Telegramme  xmlns="http://www.storagement.de/LVS/Telegramme">
<bvclsadr
         LEN="001"  SKZ="001">
         <BOVACSA>00001</BOVACSA>
         <LANR>nr2001</LANR>
         <ANRED>Herr</ANRED>
         <VSAD1>Name1</VSAD1>
         <VSAD2>Name2</VSAD2>
         <VSAD3>Name3</VSAD3>
         <VSAD4>Name4</VSAD4>
</bvclsadr>
<bvclsadr
         LEN="001"  SKZ="001">
         <BOVACSA>00002</BOVACSA>
         <LANR>nr2002</LANR>
         <ANRED>Herr</ANRED>
         <VSAD1>Name1</VSAD1>
         <VSAD2>Name2</VSAD2>
         <VSAD3>Name3</VSAD3>
         <VSAD4>Name4</VSAD4>
</bvclsadr>
<bvclsadr
         LEN="001"  SKZ="001">
         <BOVACSA>00003</BOVACSA>
         <LANR>nr2003</LANR>
         <ANRED>Herr</ANRED>
         <VSAD1>Name1</VSAD1>
         <VSAD2>Name2</VSAD2>
         <VSAD3>Name3</VSAD3>
         <VSAD4>Name4</VSAD4>
</bvclsadr>
</Telegramme>
 
i got this output:
START printNode
 
         00001
         nr2001
         Herr
         Name1
         Name2
         Name3
         Name4
 
END printNode
START printNode
 
         00002
         nr2002
         Herr
         Name1
END printNode
START printNode
 
         00003
         nr2003
         Herr
         Name1
         Name2
         Name3
         Name4
 
END printNode
 
second Node is invalid.
My suggestion when you test the xmlTextReaderExpand function, modify a bit the xml-file. Add just only one, two or three rows more in xml-file to proceed.
 
with best regards
 
Evgeny Usorov
 
 


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