Re: [xml] 2Bugs in xmlTextReaderExpand()



[Cc'ing the list]

On Thu, Jul 17, 2003 at 07:26:43PM +0200, Berlinez Oussorov fhtw-berlin de wrote:
Hallo,
1. It's ok when the the nodes after Expand() contains more Nodes.
2. But the problem, that Expand() produces sometimes invalid 
node remains.

I can't test with python or something else then C. So I took 
the testReader.c
programm and modified ONLY the processNode() function. 
Here is the code:

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 this Element 
*/
              node = xmlTextReaderExpand(reader);
              printf("START printNode\n");
              printf("%s\n",xmlNodeGetContent(node)); /*Print 
the Content*/
              printf("END printNode\n");
              xmlTextReaderNext(reader);       /*Skip to next 
Element*/
          }

            elem++;
            attrs += xmlTextReaderAttributeCount(reader);
    }
    if(name!=NULL){
        xmlFree(name);
    }
}

for the same xmlFile:
<?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>
</bvclsadr>
<bvclsadr
        LEN="001"  SKZ="001">
        <BOVACSA>00002</BOVACSA>
        <LANR>nr2002</LANR>
        <ANRED>Herr</ANRED>
        <VSAD1>Name1</VSAD1>
        <VSAD2>Name2</VSAD2>
        <VSAD3>Name3</VSAD3>
</bvclsadr>
<bvclsadr
        LEN="001"  SKZ="001">
        <BOVACSA>00003</BOVACSA>
        <LANR>nr2003</LANR>
        <ANRED>Herr</ANRED>
        <VSAD1>Name1</VSAD1>
        <VSAD2>Name2</VSAD2>
        <VSAD3>Name3</VSAD3>
</bvclsadr>

</Telegramme>

I get this output:
START printNode

        00001
        nr2001
        Herr
        Name1
        Name2
        Name3

END printNode
START printNode

        00002
        nr2002
        Herr
        Name1
        Name2
        Name3

END printNode
START printNode

        00003

END printNode

two first Elements were expanded exactly, but the last Node is 
invalid.
I tried also with more Elements and the problem is the same. 
Sometimes
there are invalid nodes. I don't know if with python the problem 
is the same.

  Okay assuming I can reproduce this it seems there is a problem.
Can you bugzilla this so I don't loose track of it ?

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
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]