forked from akrennmair/newsbeuter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
testpp.cpp
35 lines (31 loc) · 831 Bytes
/
testpp.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
#include <xmlpullparser.h>
#include <fstream>
#include <iostream>
using namespace std;
using namespace noos;
#ifdef _TESTPP
int main(int argc, char * argv[]) {
if (argc < 2)
return 1;
xmlpullparser xpp;
fstream f(argv[1]);
xpp.setInput(f);
for (xmlpullparser::event e = xpp.next(); e != xmlpullparser::END_DOCUMENT; e = xpp.next()) {
switch (e) {
case xmlpullparser::START_TAG:
cout << "start tag: " << xpp.getText() << endl;
for (unsigned int i=0;i<xpp.getAttributeCount();++i) {
cout << " attribute: " << xpp.getAttributeName(i) << " = " << xpp.getAttributeValue(i) << endl;
}
break;
case xmlpullparser::TEXT:
cout << "text: " << xpp.getText() << endl;
break;
case xmlpullparser::END_TAG:
cout << "end tag: " << xpp.getText() << endl;
break;
}
}
return 0;
}
#endif