#include "tinyxml2.h" using namespace tinyxml2; XMLElement* root = new XMLElement("root");
root->SetAttribute("version", "1.0");
XMLElement* child = root->InsertNewChildElement("child"); child->SetText("Hello World!");
const char* version = root->Attribute("version");
const char* text = child->GetText();In these examples, we have used the TinyXML-2 library to create and manipulate XML documents. The XMLElement class provides an easy-to-use interface for accessing and modifying elements and attributes in an XML document.