summaryrefslogtreecommitdiffstats
path: root/doc/src
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2009-08-17 14:55:58 (GMT)
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2009-08-18 17:10:56 (GMT)
commit393f5d5b2705c0ed7e6e1a3a69cc9cdf16cf334d (patch)
tree3b20e5280bf629e6360eaa35b23019e77b66a4c4 /doc/src
parente08ca6bcaf5fc746fdf8f3e379c17bf0a9daa771 (diff)
downloadQt-393f5d5b2705c0ed7e6e1a3a69cc9cdf16cf334d.zip
Qt-393f5d5b2705c0ed7e6e1a3a69cc9cdf16cf334d.tar.gz
Qt-393f5d5b2705c0ed7e6e1a3a69cc9cdf16cf334d.tar.bz2
Added two convenience functions to QXmlStreamReader
QXmlStreamReader::readNextStartElement reads until the next start element within the current element, or returns false when no such element is encountered before the end element is reached. It simplifies the common case of iterating over the elements in an XML document. QXmlStreamReader::skipCurrentElement reads until the end element of the current element, skipping any child elements. This functionality was requested in two tasks, and a similar function 'readUnknownElement' was present in Qt's stream reader example. Autotest is included, example and documentation have been updated. Task-number: 238793 Reviewed-by: mae
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/examples/qxmlstreambookmarks.qdoc13
1 files changed, 6 insertions, 7 deletions
diff --git a/doc/src/examples/qxmlstreambookmarks.qdoc b/doc/src/examples/qxmlstreambookmarks.qdoc
index def4c47..26964c4 100644
--- a/doc/src/examples/qxmlstreambookmarks.qdoc
+++ b/doc/src/examples/qxmlstreambookmarks.qdoc
@@ -106,19 +106,18 @@
of reading only takes place if the file is a valid XBEL 1.0 file.
Note that the XML input needs to be well-formed to be accepted by
QXmlStreamReader. Otherwise, the \l{QXmlStreamReader::raiseError()}
- {raiseError()} function is used to display an error message.
+ {raiseError()} function is used to display an error message. Since the
+ XBEL reader is only concerned with reading XML elements, it makes
+ extensive use of the \l{QXmlStreamReader::readNextStartElement()}
+ convenience function.
\snippet examples/xml/streambookmarks/xbelreader.cpp 1
- The \c readUnknownElement() function reads an unknown element. The
- Q_ASSERT() macro is used to provide a pre-condition for the function.
-
- \snippet examples/xml/streambookmarks/xbelreader.cpp 2
-
The \c readXBEL() function reads the name of a startElement and calls
the appropriate function to read it, depending on whether if its a
"folder", "bookmark" or "separator". Otherwise, it calls
- \c readUnknownElement().
+ \l{QXmlStreamReader::skipCurrentElement()}. The Q_ASSERT() macro is used
+ to provide a pre-condition for the function.
\snippet examples/xml/streambookmarks/xbelreader.cpp 3