Note that there are some explanatory texts on larger screens.

plurals
  1. POParse XmlHttpRequest to XmlListModel
    primarykey
    data
    text
    <p>I want to get my retrieved xmlHttpRequest object into an XMLListModel. I am using qml. The main goal is to evaluate the xml I get and show the entries in a list. If there's a better method - let me know.</p> <p>I found a "solution" here for analyzing the xml: <a href="http://developer.nokia.com/Community/Discussion/showthread.php/232839-Qt-Quick-and-DOM-doc-responseXML-returns-null" rel="nofollow noreferrer">http://developer.nokia.com/Community/Discussion/showthread.php/232839-Qt-Quick-and-DOM-doc-responseXML-returns-null</a> and here <a href="https://stackoverflow.com/questions/5410796/parse-xml-from-xmlhttprequest">Parse XML from XMLHttpRequest</a> But it is VERY poor to dig in deep xml structures, because there are loops arround every level of the xml tree.</p> <p>So the 2 ways I would like to have:</p> <h1>1: XmlList</h1> <p>This would be my favourite: parse the data I got from the xmlHttpRequest to a XmlList thing and get the list for free (automatically). This guy wanted the same, but didn't write out a solution: <a href="http://qt-project.org/forums/viewthread/6460" rel="nofollow noreferrer">http://qt-project.org/forums/viewthread/6460</a></p> <p>I also tried:</p> <pre><code>XmlListModel{id: xmlModel} ... xmlModel.xml = xhr.responseXML; </code></pre> <p>The first one separately, and the last line, where I get the xml. This says "Error: Cannot assign null to QString". I am sure, that I get a correct xml answer, because the above mentioned method with searching for each child and the tagname is working. Also I found a different notation with something like a parser, but that didn't work either.</p> <h1>2: XPath</h1> <p>var doc = new DOMParser().parseFromString(response, "text/xml"); returnes DOMParser not defined .. so I guess I would need some library there, but didn't find anything about the topic (else than unanswered questions). (Same with .getElementById and evaluateXPath and many other thing I found on the net)</p> <p>Any hint is appreciated!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload