Reputation: 197
I'm working on an JavaScript project, that is parsing a XML to fill some input fields. I was wondering, why this loop section is working perfectly fine in Firefox or Chrome but not in IE...
var results = xmlDoc.getElementsByTagName("ResultSet");
for (var i = 0; i < results.length; i++) {
if(results.item(i).getAttribute("queryID") == "get-pos"){
var rows = results.item(i).children;
for (var j = 0; j < rows.length; j++) {
var columns = rows.item(j).children;
my results
loop is working fine but none of the following... when i look at the debug window in IE it says rows
would be undefined.
As far as i can see .children
is unknown.
After some reasearch i tried results[i]
instead of results.item(i)
without any change. (I guess because it's basically the same?)
Why is it not working in IE but in the other browsers? And how can i fix it?
Upvotes: 3
Views: 1880
Reputation: 952
Older versions of IE did not support the children property on XML documents.
Try using childNodes
instead
Upvotes: 5