This is an example of how Dom Parser works. It will parse the xml file (person.xml) to the Person object. A DTD validation will be run on this example.
 
ID: 1
First name: Alicia
Last name: Smith
Sex: F
Date of birth: 13/10/1978
Address: Grand Avenue, 143
   Toronto 2283
   Canada
 
 
ID: 2
First name: Maria
Last name: White
Sex: F
Date of birth: 29/5/1980
Address: Green Land Park, 143
   Vancouver BC V6C 2C2
   Canada
 
 
 
 
 
 
 
class Date {
public:
   Date() : day(0), month(0), year(0) { }
   Int_t GetDay()
 const { 
return day; }
 
   Int_t GetMonth()
 const { 
return month; }
 
   Int_t GetYear()
 const { 
return year; }
 
private:
};
 
class Address {
public:
   Address() { }
      street(
s), postalCode(p), country(
c) { }
   TString GetStreet()
 const { 
return street; }
 
   TString GetPostalCode()
 const { 
return postalCode; }
 
   TString GetCountry()
 const { 
return country; }
 
   void SetStreet(
const TString &
s) { street = 
s; }
 
   void SetPostalCode(
const TString &p) { postalCode = p; }
 
   void SetCountry(
const TString &
c) { country = 
c; }
 
private:
};
 
public:
   Person() { }
      id(i), firstName(
f), lastName(
l), gender(
g), dateOfBirth(
d), address(
a){ }
 
 
   ~Person() {
      delete dateOfBirth;
      delete address;
   }
 
   TString GetFirstName()
 const { 
return firstName; }
 
   TString GetLastName()
 const { 
return lastName; }
 
   Char_t GetGender()
 const { 
return gender; }
 
   Date *GetDate() const { return dateOfBirth; }
 
   friend ostream & 
operator << (ostream& out, 
const Person& p) {
 
      out << "ID: " << p.id << endl;
      out << "First name: " << p.firstName << endl;
      out << "Last name: " << p.lastName << endl;
      out << "Sex: " << p.gender << endl;
      out << "Date of birth: " << p.dateOfBirth->GetDay() << "/"
          << p.dateOfBirth->GetMonth() << "/"
          << p.dateOfBirth->GetYear() << endl;
      out << "Address: " << p.address->GetStreet() << endl;
      out << "\t" << p.address->GetPostalCode() << endl;
      out << "\t" << p.address->GetCountry() << endl;
      out << endl;
      return out;
   }
 
private:
   Date     *dateOfBirth;
   Address  *address;
};
 
class PersonList {
public:
   PersonList() {
      listOfPerson = 
new TList();
   }
 
 
      if (parsecode < 0) {
         return -1;
      }
 
 
      ParsePersonList(node);
 
      return 0;
   }
 
                     if (strcmp(attr->
GetName(), 
"ID") == 0) {
 
                        break;
                     }
                  }
               }
               listOfPerson->Add(ParsePerson(node->
GetChildren(), 
id));
            }
         }
      }
   }
 
            }
            }
            }
         }
      }
      return new Date(
d, 
m, 
y);
 
   }
 
            }
            }
            }
         }
     }
     return new Address(
s, p, 
c);
 
   }
 
      char gender = ' ';
      Date *date;
      Address *address;
 
         }
     }
 
     return new Person(id, firstName, lastName, gender, date, address);
   }
 
   friend ostream& 
operator << (ostream& out, 
const PersonList & pl) {
 
      TIter next(pl.listOfPerson);
 
      Person *p;
      while ((p =(Person*)next())){
         out << *p << endl;
      }
      return out;
   }
 
   void PrintPerson() {
      TIter next(listOfPerson);
 
      Person *p;
      while ((p =(Person*)next())) {
         cout << *p << endl;
      }
   }
 
private:
};
 
 
void DOMParsePerson()
{
   PersonList personlist;
   gROOT->ProcessLine(
".O 0");
 
   if (personlist.ParseFile(dir+"/xml/person.xml") == 0)
      cout << personlist << endl;
}
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
virtual TXMLDocument * GetXMLDocument() const
Returns the TXMLDocument.
virtual Int_t ParseFile(const char *filename)
Parse the XML file where filename is the XML file name.
Mother of all ROOT objects.
TXMLAttribute is the attribute of an Element.
const char * GetValue() const
const char * GetName() const
Returns name of object.
TXMLNode * GetRootNode() const
Returns the root element node.
TXMLNode contains a pointer to xmlNode, which is a node under the DOM tree.
TList * GetAttributes()
Returns a list of node's attribute if any, returns 0 if no attribute.
const char * GetText() const
Returns the content of a Text node if node is a TextNode, 0 otherwise.
TXMLNode * GetNextNode()
Returns the next sibling XMLNode in the DOM tree, if any return 0 if no next node.
TXMLNode * GetChildren()
Returns the node's child if any, returns 0 if no child.
const char * GetNodeName() const
Returns the node's name.
Bool_t HasAttributes() const
Returns true if Element node has attribute.
EXMLElementType GetNodeType() const
Returns the node's type.
const char * GetParseCodeMessage(Int_t parseCode) const
Returns the parse code message.
ULong64_t GetAddress(std::vector< std::string > &p)
static constexpr double s