Skip to content Skip to sidebar Skip to footer

Exception Xml.getelementsbytagname Is Not A Function, When Trying To Parse An Xml

I'm trying to parse xml from an notes.xml, it show an error in firebug as TypeError: xml.getElementsByTagName is not a function My code part is, notes.xml

Solution 1:

Your alert statement is wrong. x has no method getElementsByTagName.

You can get the first city using:

alert(x[0].attributes[0].nodeValue); // shows Scottsdale

The second one is:

alert(x[1].attributes[0].nodeValue); // shows Arcadia

And states:

alert(x[0].attributes[1].nodeValue);  // AZalert(x[1].attributes[1].nodeValue);  // CA

Post a Comment for "Exception Xml.getelementsbytagname Is Not A Function, When Trying To Parse An Xml"