Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_corelib_xml_qxmlstream.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QXmlStreamReader>
5#include <QXmlStreamWriter>
6
7void examples()
8{
9 {
10 //! [0]
11 QXmlStreamReader xml;
12 //...
13 while (!xml.atEnd()) {
14 xml.readNext();
15 //... do processing
16 }
17 if (xml.hasError()) {
18 //... do error handling
19 }
20 //! [0]
21 }
22
23 QXmlStreamWriter stream;
24 QString qualifiedName, namespaceUri, name, text;
25
26 {
27 //! [1]
28 stream.writeStartElement(qualifiedName);
29 stream.writeCharacters(text);
30 stream.writeEndElement();
31 //! [1]
32 }
33
34 {
35 //! [2]
36 stream.writeStartElement(namespaceUri, name);
37 stream.writeCharacters(text);
38 stream.writeEndElement();
39 //! [2]
40 }
41}
bool examples()
[3]