cross-browser 'getElementsByTagName' with namespace from responseXML cross-browser 'getElementsByTagName' with namespace from responseXML google-chrome google-chrome

cross-browser 'getElementsByTagName' with namespace from responseXML


This is what I use:

function byTagNS(xml,tag,ns) {    return xml.getElementsByTagNameNS      ? xml.getElementsByTagNameNS(ns,tag)      : xml.getElementsByTagName(ns+":"+tag);}

With in your case:

byTagNS(responseXML, "row", "z")


If you don't care about the namespace then you could use the following:

xml.getElementsByTagNameNS("*", "yourElementHere")

This will fetch any element with the desired name regardless of which namespace it has or whether it has any namespace at all. Additionally, this should work as expected across different browsers.

See link for documentation.