#include "rapidxml.hpp" using namespace rapidxml; int main() { // Load an XML document file<> xml_file("example.xml"); xml_document<> doc; doc.parse<0>(xml_file.data()); // Get the root node of the document xml_node<>* root = doc.first_node(); // Iterate over the child nodes of the root node for (xml_node<>* child = root->first_node(); child; child = child->next_sibling()) { // Do something with each child node // ... } return 0; }
#include "tinyxml.h" int main() { // Load an XML document TiXmlDocument doc("example.xml"); doc.LoadFile(); // Get the root element of the document TiXmlElement* root = doc.RootElement(); // Get the value of a child element const char* value = root->FirstChildElement("child")->GetText(); // Do something with the value // ... return 0; }Both of these examples use the XML_Node child function to navigate the child nodes of an XML document, but they use different libraries (RapidXML and TinyXML) to do so.