Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. XMLHttpRequest response with XmlListModel

XMLHttpRequest response with XmlListModel

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hornsj2
    wrote on last edited by
    #1

    I've seen several questions on this topic with no answer (that I can find).

    Basically I'm sending a request to a server which returns an XML response.

    The problem I'm having now is that with the code below I seem to get an access violation if I assign responseText to the xml property of my XmlListModel.

    Here's my code:

    @

    XmlListModel{
    id: xmlModel

      //  XmlRole { name: "type"; query: "@MODULE_TYPE/string()" }
      //  XmlRole { name: "state"; query: "@MODULE_STATE/string()" }
        
        
    
    }
    

    Button {
    id: button5
    width: 47
    height: 47
    anchors.right: parent.right
    anchors.rightMargin: 360
    anchors.top: button4.bottom
    anchors.topMargin: 20

       onClicked{
       var doc = new XMLHttpRequest();
            doc.open("POST", "http://" + ConfigPrefs.url() + "/cgi-bin/tsaws.cgi", true);
            doc.setRequestHeader('Content-Type', 'text/xml;charset=UTF-8');
            doc.send("<TSA_REQUEST_LIST PASSWORD=\"\"><TSA_REQUEST      COMMAND=\"cmdAppGetSystemStatus\"/></TSA_REQUEST_LIST>");
            doc.onreadystatechange = function(){
                if((doc.readyState == 4) && (doc.status == 200) )
                {
                    console.log(doc.responseText);
                    xmlModel.xml = doc.responseText;
                }
     }
    

    }

    @

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Hornsj2
      wrote on last edited by
      #2

      "This seems to be related":https://bugreports.qt.nokia.com/browse/QTBUG-21286

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved