I write an xml document like this:
<doc>
<node1>
<value1>aa bb</value1>
<value2>cc dd</value2>
</node1>
<node2>
<value1>aaa bbb</value1>
<value2>ccc ddd</value2>
</node2>
</doc>
I try to parse this document with minixml library :
mxml_node_t *b = tree, *c; //tree is global variable
while (b) {
if (b && b->type == MXML_ELEMENT) {
if(strcmp(b->value.element.name, "value1") == 0)
{
c = mxmlWalkNext(b, b, MXML_DESCEND);
if (c && c->type == MXML_TEXT)
{
if(c->value.text.string != NULL)
{
printf("value1=%s"c->value.text.string);
}
}
}
}
if (b && b->type == MXML_ELEMENT) {
if(strcmp(b->value.element.name, "value2") == 0)
{
c = mxmlWalkNext(b, b, MXML_DESCEND);
if (c && c->type == MXML_TEXT)
{
if(c->value.text.string != NULL)
{
printf("value2=%s"c->value.text.string);
}
}
}
}
b = mxmlWalkNext(b, tree, MXML_DESCEND);
}
When I parse the file I found this result:
value1=aa //the value is not right it must be "aa bb"
value2=cc
...
Have you an idea, how to solve my problem?