Good day fellow programmers,

I am trying to communicate with a rest API web service, get a xml document and then parse it’s values into strings.
Since I am new to this topic any help would be greatly appreciated!

This is what I built using the XMLHTTPREQUEST example:
import QtQuick 2.0

Qt Code:
  1. Rectangle {
  2. width: 350; height: 400
  3.  
  4. function showRequestInfo(text) {
  5. log.text = log.text + "\n" + text
  6. console.log(text)
  7. }
  8.  
  9. Text { id: log; anchors.fill: parent; anchors.margins: 10 }
  10.  
  11. Rectangle {
  12. id: button
  13. anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; anchors.margins: 10
  14. width: buttonText.width + 10; height: buttonText.height + 10
  15. border.width: mouseArea.pressed ? 2 : 1
  16. radius : 5; smooth: true
  17.  
  18. Text { id: buttonText; anchors.centerIn: parent; text: "Request" }
  19.  
  20. MouseArea {
  21. id: mouseArea
  22. anchors.fill: parent
  23. onClicked: {
  24. log.text = ""
  25. console.log("\n")
  26.  
  27. var doc = new XMLHttpRequest();
  28. doc.onreadystatechange = function() {
  29. if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
  30.  
  31.  
  32. } else if (doc.readyState == XMLHttpRequest.DONE) {
  33. var a = doc.responseXML.documentElement;
  34. for (var ii = 0; ii < a.childNodes.length; ++ii) {
  35. showRequestInfo(a.childNodes[ii].nodeName);
  36. }
  37. }
  38. }
  39.  
  40.  
  41. doc.open("POST", 'http://www.example.com/mydata.xml');
  42. doc.send();
  43. }
  44. }
  45. }
  46. }
To copy to clipboard, switch view to plain text mode 
This code does successfully communicate with the server and retrieves information from it.
The problem is that it only names the node’s name but leaves the values out.

Example response:

Qt Code:
  1. is-admin
  2. #text
  3. signature
  4. #text
  5. restrictions
  6. #text
To copy to clipboard, switch view to plain text mode 
How can I fix this and manage to save the information retrieved with the xml document into strings?

Thanks a LOT in advance!