Important: Please read the Qt Code of Conduct -

[solved] How do I merge two XML documents?

  • I'm developing a public transport app that gets travel data from a web service in an XML format. A request however only returns five items with the data I want to present, so I will have to make multiple requests. Additionally I want to have a "pull and release" functionality to request earlier and later travel data. How do I merge the original XML document from the first request with the documents from the subsequent requests?
    Currently I use XMLHttpRequest and just set the XmlListModel's xml property to the responseText of the XMLHttpRequest object when it finishes its request, but that just replaces the xml.

    Edit: Since XmlListModel is read-only, I solved it by using two models. One regular ListModel for the ListView and one XmlListModel for handling the request XML with XPath. In the XmlListModel's onItemInserted the items are then inserted into the ListModel.

Log in to reply