summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml
blob: faf3af0acbcdac3bbff16f320d0abef19ebd30e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import QtQuick 1.0

QtObject {
    property bool xmlTest: false
    property bool dataOK: false

    function checkXML(document)
    {
        if (document.xmlVersion != "1.0")
            return;

        if (document.xmlEncoding != "UTF-8")
            return;

        if (document.xmlStandalone != true)
            return;

        if (document.documentElement == null)
            return;

        if (document.nodeName != "#document")
            return;

        if (document.nodeValue != null)
            return;

        if (document.parentNode != null)
            return;

        // ### Test other node properties
        // ### test encoding (what is a valid qt encoding?)
        xmlTest = true;
    }

    Component.onCompleted: {
        var x = new XMLHttpRequest;

        x.open("GET", "document.xml");

        // Test to the end
        x.onreadystatechange = function() {
            if (x.readyState == XMLHttpRequest.DONE) {

                dataOK = true;

                if (x.responseXML != null)
                    checkXML(x.responseXML);

            }
        }

        x.send()
    }
}