user91556
user91556

Reputation: 41

error on getAttribute while parsing an xml document in Internet Explorer

I'm calling a webservice from javascript and then parsing the xml and rendering tables. All is well in firefox, but in IE its a different story.

The problem seems to be on this this line

var count = result.childNodes[0].getAttribute('Count'); 

Is there an IE friendly way to get an xml attribute in javascript?

the rest of the code works fine. but unfortunately i need that count.

Upvotes: 1

Views: 1543

Answers (1)

Dan Polites
Dan Polites

Reputation: 6810

This works in IE 7:

x=xmlDoc.getElementsByTagName("book")[0].attributes;
document.write(x.getNamedItem("category").nodeValue);

book is your element name and category is the name of the attribute. I found this example on W3Schools:

Upvotes: 1

Related Questions