XMLHttpRequest problem
Hello everyone,
experimenting with fresh install of QTSDK 1.1.3.
I have this JS, which gets executed, on a mouse click:
- onClicked: {
- var doc = new XMLHttpRequest();
- doc.onreadystatechange = function() {
- if (doc.readyState == XMLHttpRequest.DONE) {
- var a = doc.responseXML.documentElement;
- for (var ii = 0; ii < a.childNodes.length; ++ii) {
- console.log(a.childNodes[ii].nodeName);
- }
- }
- }
- doc.open("GET", "data.xml");
- doc.send();
- }
This is my data.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <document>
- <content>
- <item>
- <name>A Test Name</name>
- <id>1</id>
- </item>
- </content>
- </document>
This gives me this output on console:
#text
content
#text
Do I miss something? Any ideas, where this #text comes from?
Regards,
ChrisQT
3 replies
From what I can see whitespace #text nodes seem to be a common issue (e.g. http://stackoverflow.com/questions/1898640/ignoring-empty-xml-nodes-in-javascript ), so you may be able to find some helpful ways of dealing with them by searching around a bit.
Regards,
Michael
[EDIT: fixed link, Volker]
You must log in to post a reply. Not a member yet? Register here!


