31 Date() : day(0), month(0), year(0) { }
33 Int_t GetDay()
const {
return day; }
34 Int_t GetMonth()
const {
return month; }
35 Int_t GetYear()
const {
return year; }
37 void SetMonth(
Int_t m) { month=
m;}
38 void SetYear(
Int_t y) { year=
y;}
49 street(s), postalCode(
p), country(
c) { }
50 TString GetStreet()
const {
return street; }
51 TString GetPostalCode()
const {
return postalCode; }
52 TString GetCountry()
const {
return country; }
53 void SetStreet(
const TString &s) { street = s; }
54 void SetPostalCode(
const TString &
p) { postalCode =
p; }
55 void SetCountry(
const TString &
c) { country =
c; }
66 id(i), firstName(
f), lastName(
l), gender(
g), dateOfBirth(
d), address(
a){ }
73 TString GetFirstName()
const {
return firstName; }
74 TString GetLastName()
const {
return lastName; }
75 Char_t GetGender()
const {
return gender; }
76 Date *GetDate()
const {
return dateOfBirth; }
77 Address *
GetAddress()
const {
return address; }
78 Int_t GetID()
const {
return id; }
80 friend ostream & operator << (ostream& out,
const Person&
p) {
81 out <<
"ID: " <<
p.id << endl;
82 out <<
"First name: " <<
p.firstName << endl;
83 out <<
"Last name: " <<
p.lastName << endl;
84 out <<
"Sex: " <<
p.gender << endl;
85 out <<
"Date of birth: " <<
p.dateOfBirth->GetDay() <<
"/"
86 <<
p.dateOfBirth->GetMonth() <<
"/"
87 <<
p.dateOfBirth->GetYear() << endl;
88 out <<
"Address: " <<
p.address->GetStreet() << endl;
89 out <<
"\t" <<
p.address->GetPostalCode() << endl;
90 out <<
"\t" <<
p.address->GetCountry() << endl;
107 listOfPerson =
new TList();
121 ParsePersonList(node);
126 void ParsePersonList(
TXMLNode *node) {
134 TIter next(attrList);
136 if (strcmp(
attr->GetName(),
"ID") == 0) {
137 id = atoi(
attr->GetValue());
142 listOfPerson->Add(ParsePerson(node->
GetChildren(),
id));
164 return new Date(
d,
m,
y);
167 Address *ParseAddress(
TXMLNode *node) {
174 if (strcmp(node->
GetNodeName(),
"PostalCode") == 0) {
182 return new Address(s,
p,
c);
199 if (strcmp(node->
GetNodeName(),
"DateOfBirth") == 0)
206 return new Person(
id, firstName, lastName, gender, date, address);
209 friend ostream& operator << (ostream& out,
const PersonList & pl) {
210 TIter next(pl.listOfPerson);
212 while ((
p =(Person*)next())){
219 TIter next(listOfPerson);
221 while ((
p =(Person*)next())) {
227 Int_t numberOfPersons;
234 PersonList personlist;
235 gROOT->ProcessLine(
".O 0");
237 if (personlist.ParseFile(dir+
"/xml/person.xml") == 0)
238 cout << personlist << endl;
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
virtual TXMLDocument * GetXMLDocument() const
Returns the TXMLDocument.
Int_t ParseFile(const char *filename) override
Parse the XML file where filename is the XML file name.
Mother of all ROOT objects.
TXMLAttribute is the attribute of an Element.
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)