#includeusing namespace Xml::s1; int main() { Document doc; doc.LoadFile("data.xml"); if (doc.Error()) { // handle error } // access data Element* root = doc.RootElement(); for (Element* child = root->FirstChildElement(); child != NULL; child = child->NextSiblingElement()) { const char* name = child->Name(); const char* value = child->GetText(); // process data } return 0; }
#includePackage/Library: Cpp Xml s1using namespace Xml::s1; int main() { Document doc; Element* root = doc.NewElement("Root"); doc.InsertEndChild(root); Element* child1 = doc.NewElement("Child1"); child1->SetText("Data 1"); root->InsertEndChild(child1); Element* child2 = doc.NewElement("Child2"); child2->SetText("Data 2"); root->InsertEndChild(child2); doc.SaveFile("data.xml"); return 0; }