With the following C++ code, using the RapidXml library, I can only get XML elements at the top level, and not the children:
char *text = ... // XML file shown below
using namespace rapidxml;
xml_document<> doc;
doc.parse<0>(text);
xml_node<> *node = doc.first_node();
while(node != 0) {
cout << node->name() << " " << node->value() << endl;
node = node->next_sibling(); // <-- ???
}
XML file:
<parent>
<child>123</child>
</parent>
<parent>
<child>456</child>
</parent>
Actual result:
parent
parent
Expected result:
parent
child 123
parent
child 456
How can I get the children?
Thank you!