equal
deleted
inserted
replaced
|
1 import Qt 4.7 |
|
2 |
|
3 QtObject { |
|
4 property bool xmlTest: false |
|
5 property bool dataOK: false |
|
6 |
|
7 function checkXML(document) |
|
8 { |
|
9 if (document.xmlVersion != "1.0") |
|
10 return; |
|
11 |
|
12 if (document.xmlEncoding != "UTF-8") |
|
13 return; |
|
14 |
|
15 if (document.xmlStandalone != true) |
|
16 return; |
|
17 |
|
18 if (document.documentElement == null) |
|
19 return; |
|
20 |
|
21 if (document.nodeName != "#document") |
|
22 return; |
|
23 |
|
24 if (document.nodeValue != null) |
|
25 return; |
|
26 |
|
27 if (document.parentNode != null) |
|
28 return; |
|
29 |
|
30 // ### Test other node properties |
|
31 // ### test encoding (what is a valid qt encoding?) |
|
32 xmlTest = true; |
|
33 } |
|
34 |
|
35 Component.onCompleted: { |
|
36 var x = new XMLHttpRequest; |
|
37 |
|
38 x.open("GET", "document.xml"); |
|
39 |
|
40 // Test to the end |
|
41 x.onreadystatechange = function() { |
|
42 if (x.readyState == XMLHttpRequest.DONE) { |
|
43 |
|
44 dataOK = true; |
|
45 |
|
46 if (x.responseXML != null) |
|
47 checkXML(x.responseXML); |
|
48 |
|
49 } |
|
50 } |
|
51 |
|
52 x.send() |
|
53 } |
|
54 } |
|
55 |
|
56 |