-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
41 lines (30 loc) · 907 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include "pugixml.cpp"
using namespace std;
using namespace pugi;
int main()
{
cout << "\nParsing Data From File\n\n";
xml_document doc;
if (!doc.load_file("sample.xml")){
cout<<"File Did not open.\n";
return 0;
}
xml_node skip = doc.child("root").child("Source_Data");
x:
xml_node sam = skip;
xml_node fName = sam.child( "Employee" );
for (xml_node_iterator it = skip.begin(); it != skip.end(); ++it)
{
for (xml_attribute_iterator ait = it->attributes_begin(); ait != it->attributes_end(); ++ait)
{
cout << ait->name() << " = " << ait->value() << "\n";
}
cout<< "Text = " <<fName.text().get()<<endl;
fName = fName.next_sibling( "Employee" );
cout << endl;
}
skip = skip.next_sibling();
goto x;
return 0;
}