I'm playing with XMLHttpRequest, but nodeValue seems to be null?

Can somebody explain why the following does not work?

https://bugreports.qt.nokia.com/browse/QTBUG-21909 seems to touch 
loosely this area.


import QtQuick 1.1

Rectangle {
   width: 360
   height: 640
   property alias artists: content.text

   Text {
     id: content
     text: "Click to fill from xml"
     anchors.centerIn: parent
   }

   MouseArea {
     id: mouseArea
     anchors.fill: parent
     onClicked: {
       var doc = new XMLHttpRequest()
       var txt = "";

       doc.onreadystatechange = function() {
             if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
               console.log("Got Headers:")
               console.log(doc.getAllResponseHeaders())
               console.log("------------");
             } else if (doc.readyState == XMLHttpRequest.DONE) {
               var a = doc.responseXML.documentElement;
               console.log(doc.responseXML.xmlStandalone)
               for (var i = 0; i < a.childNodes.length; ++i) {
                 if (a.childNodes[i].nodeName === 'CD') {
                   var cd = a.childNodes[i]
                   for (var j = 0; j < cd.childNodes.length; ++j) {
                     if (cd.childNodes[j].nodeName === 'ARTIST') {
                       console.log('ARTIST', cd.childNodes[j].nodeValue);
                       txt += cd.childNodes[j].nodeValue + "<br />"
                     }
                   }
                 }
               }
               artists = txt;
             }
           }

       var url = "http://www.w3schools.com/Ajax/cd_catalog.xml";
       doc.open("GET", url)
       doc.send()
     }
   }
}

_______________________________________________
Qt-qml mailing list
Qt-qml@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to