falcong / pugixml

Automatically exported from code.google.com/p/pugixml
0 stars 0 forks source link

Pugixml 0.5 parse text error for 
 in my string #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello , I am a pugixml user .and I found a bug in pugixml 0.5. I am writing
a game and use xml as my map file format .I use 20 lines of ints for my may
data.(IDData).when I parse this xml . I find the last 3 lines of data are
lost . in my memory viewer.I see the NULL char is insert before the last 3
lines .

I attach this bug xml file.and the image of my memory viewer .thanks.

Original issue reported on code.google.com by Yuki...@gmail.com on 19 Apr 2010 at 4:13

Attachments:

GoogleCodeExporter commented 9 years ago
I'm unable to reproduce this; the following code shows 10 lines and all symbols 
appear 
correct:

#include "pugixml.hpp"

#include <stdio.h>

int main()
{
    pugi::xml_document doc;
    printf("%s\n", doc.load_file("map01.xml").description());

    const char* string = doc.child("Map").child("MapData").child_value("IDData");

    printf("Plain-text:\n%s\n\n", string);
    printf("Hex:\n");

    while (*string)
    {
        printf("%02x ", *string);
        if (*string == '\n') printf("\n");

        ++string;
    }
}

Please provide additional information:
- How do you parse the xml? (load_file, load, etc.)
- The memory view looks strange (unless you captured the screenshot in the 
middle of 
parsing process, not after it's finished), i.e. it's not what a fully parsed 
buffer should 
look like - how did you get the address that's displayed?

Please note that additional 
 after the null terminating symbol are expected - 
each 
 (12 characters) is replaced by 0x0d 0x0a pair (2 characters), so each 
such pair shifts the text to the left by 10 characters, so for 9 line 
terminator a space 
of 90 characters appears at the right end of the string. This space is not 
cleared with 
anything, so the original buffer contents is there.

Original comment by arseny.k...@gmail.com on 19 Apr 2010 at 4:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Oh sorry. The bug is in my own code. I just fix it .sorry for this bug report. 
and
thank you.

Original comment by Yuki...@gmail.com on 19 Apr 2010 at 5:30

GoogleCodeExporter commented 9 years ago
No problem :) I'm glad everything works for you!

Original comment by arseny.k...@gmail.com on 19 Apr 2010 at 5:35