Ok, as I didn’t know about it, it’s probably my fault, but I’ve wasted some time on the problem and I want to put this here just for records.
Let’s say my XML is in a form like the following:
... <code>here a short code number</code> <message>here a long long message</message> ...
var xml = ajax.responseText; var xmlDocument = (new DOMParser()).parseFromString(xml,'application/xml'); var code = xmlDocument.getElementsByTagName('code').firstChild.nodeValue; var message = xmlDocument.getElementsByTagName('message').firstChild.nodeValue;
In this case the variable code is correctly set, as the <code> tag contains only a few bytes, instead the variable message doesn’t contain the whole <message> content, but only the first 4kB.
Simple workaround (maybe too simple?):
var message = ”;
var tmp = xmlDocument.getElementsByTagName(‘message’);
for (i=0; i