diff options
Diffstat (limited to 'doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc')
-rw-r--r-- | doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc b/doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc new file mode 100644 index 0000000..c74a176 --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc @@ -0,0 +1,20 @@ +//! [0] +// file is an open QFile object. +QDomDocument document; +if (document.setContent(&file)) { + + QDomElement documentElement = document.documentElement(); + QString text; + QDomNode node = documentElement.firstChild(); + + while (!node.isNull()) { + if (node.isText()) + text += node.nodeValue(); + else if (node.hasChildNodes()) { + // Examine the node's children and read any text found. + ... + } + node = node.nextSibling(); + } +} +//! [0] |