C++
C#
VB
JScript
All

# XML

Copyright (C) 2005 IENT-RWTH Aachen

GENIAL provides a DOM-like XML-container.

The following example loads an XML file, inserts new elements in the tree structure, and saves it.

    #include "xml.h"

    int main()
    {
      XMLFile fin("x.xml");
      XMLTree xml;
      fin >> xml;  // load "x.xml"

      xml.push_back("first"); // insert "first"
      XMLTree::reference x = xml.back(); // reference on "first"
      x.push_back("second"); // insert "first->second"
      x.push_back(XMLElem("third","data of third")); //insert "first->third" with text
      x["second"].data() = "data of second"; // find "second" and change its text.

      XMLFile fout("y.xml");
      fout << xml; //save in "y.xml"
    }

See Also

Tutorial