1

This question slightly differs from check for variable number of sibling nodes & different siblings in Rapidxml. In most of the examples I have found on the web I see hard coded keys, for example:

xml_node<>* root = doc.first_node("rootnode");

Here "rootnode" is hard coded. My situation is slightly different, in the sense that parsing and tagging is already done by rapidxml. I need to know the names as read by the parser by iterating over nodes and their sibling without knowing the hard coded name and the depth of the node. I am looking for the suggestion/solution on some kind of recursive navigation along rapidxml tree.

Thank you.

Community
  • 1
  • 1
Rajesh
  • 11
  • 1

1 Answers1

2

According to RapidXml's documentation (see here) the node name parameter in first_node() method is optional. You can just omit that parameter and you will get the first child node, regardless of its name:

xml_node<>* root = doc.first_node();

Then you can just get node's name by calling its name() method.

jimvonmoon
  • 342
  • 3
  • 12