Qt 5.10 Book Examples
chapter40
XmlStreamReader
main.cpp
Go to the documentation of this file.
1
// ======================================================================
2
// main.cpp
3
// ======================================================================
4
// This file is a part of the book
5
// "Qt 5.10 Professional programming with C++"
6
// http://qt-book.com
7
// ======================================================================
8
// Copyright (c) 2017 by Max Schlee
9
// ======================================================================
10
11
#include <QtXml>
12
13
// ----------------------------------------------------------------------
14
int
main
()
15
{
16
QFile file(
"addressbook.xml"
);
17
if
(file.open(QIODevice::ReadOnly)) {
18
QXmlStreamReader sr(&file);
19
do
{
20
sr.readNext();
21
qDebug() << sr.tokenString() << sr.name() << sr.text();
22
}
while
(!sr.atEnd());
23
24
if
(sr.hasError()) {
25
qDebug() <<
"Error:"
<< sr.errorString();
26
}
27
file.close();
28
}
29
30
return
0;
31
}
main
int main(int argc, char **argv)
Definition:
main.cpp:15
Generated by
1.8.14