Parsing XML Namespaces?
Using JavaScript/Ajax? I'm trying to extract values from: Looking for something like: var response = transport.res
Solution 1:
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
Post a Comment for "Parsing XML Namespaces?"