#include "rapidxml.hpp" using namespace rapidxml; int main() { xml_document<> doc; xml_node<>* root = doc.allocate_node(node_element, "root"); // Setting text for a new XML node xml_node<>* child = doc.allocate_node(node_element, "child"); child->value("Hello, World!"); root->append_node(child); doc.append_node(root); // Printing the XML document std::cout << doc; }
#include "rapidxml.hpp" using namespace rapidxml; int main() { // Parsing an XML document xml_document<> doc; doc.parse("In this example, we parse an XML document and then use the SetText method to update the text value of the child node from "Initial text" to "Updated text". Finally, we print the updated XML document to the console."); // Updating text for an existing XML node xml_node<>* child = doc.first_node("root")->first_node("child"); child->value("Updated text"); // Printing the updated XML document std::cout << doc; } Initial text