summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc
blob: c74a1766806fd9b1aa60175b842f302602ac4c7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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]