Parsing XML namespaces?

There is a special version of getElementsByTagName for namespaces: getElementsByTagNameNS.

For example:

var response = transport.responseXML.getElementsByTagName("channel");
var sunrise = response[0].getElementsByTagNameNS("[Namespace URI]", "astronomy")[0].getAttribute("sunrise");

…where [Namespace URI] is the URI of the yweather namespace.

Steve

Leave a Comment