0

I have xml.xml file:

<root>Root
    <pai>Pai_1
        <filho>Pai1,Filho1</filho>
        <filho>Pai1,Filho2</filho>
    </pai>
    <pai>Pai_2
        <filho>Pai2,Filho1</filho>
        <filho>Pai2,Filho2</filho>
    </pai>
</root>

This file is loaded and then saved.

FILE *fp;
 mxml_node_t *tree;

    fp = fopen("xml.xml", "r");
    tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK);
    fclose(fp);

    fp = fopen("xmlout.xml", "w");
    mxmlSaveFile(tree, fp, MXML_NO_CALLBACK);
    fclose(fp);

On xmlout.xml I have:

<root>
    <pai>
        <filho /><filho />
    </pai>
    <pai>
        <filho /><filho />
    </pai>
</root>

Where are values?

vico
  • 17,051
  • 45
  • 159
  • 315

1 Answers1

0

There appears to be a bug in mini-xml 2.8 handling of mxmlLoadFd() MXML_NO_CALLBACK/MXML_TEXT_CALLBACK that loses text nodes.

See minixml bug 502 for details.

As a workaround, define your own text callback, and pass that to mxmlLoadFd instead.

bitoiu
  • 6,893
  • 5
  • 38
  • 60
lew
  • 1