diff options
Diffstat (limited to 'src/corelib/xml/qxmlstream.cpp')
-rw-r--r-- | src/corelib/xml/qxmlstream.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index bff4e15..ff1a01f 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -2792,9 +2792,9 @@ QStringRef QXmlStreamReader::documentEncoding() const \inmodule QtXml \ingroup xml-tools - QXmlStreamWriter is the pendent to QXmlStreamReader for writing + QXmlStreamWriter is the counterpart to QXmlStreamReader for writing XML. Like its related class, it operates on a QIODevice specified - with setDevice(). The API is simple and straight forward: For every + with setDevice(). The API is simple and straightforward: for every XML token or event you want to write, the writer provides a specialized function. @@ -2814,6 +2814,15 @@ QStringRef QXmlStreamReader::documentEncoding() const writeStartElement(). A convenience method writeTextElement() can be used for writing terminal elements that contain nothing but text. + The following abridged code snippet shows the basic use of the class + to write formatted XML with indentation: + + \snippet doc/src/snippets/qxmlstreamwriter/main.cpp start stream + \dots + \snippet doc/src/snippets/qxmlstreamwriter/main.cpp write element + \dots + \snippet doc/src/snippets/qxmlstreamwriter/main.cpp finish stream + QXmlStreamWriter takes care of prefixing namespaces, all you have to do is specify the \c namespaceUri when writing elements or attributes. If you must conform to certain prefixes, you can force |