使用JavaScript/Ajax?
我尝试从以下位置提取值:
<yweather:astronomy sunrise="6:34 am" sunset="8:38 pm"/>查找类似以下内容:
var response = transport.responseXML.getElementsByTagName("channel");
sunrise = response[0].getElementsByTagName("yweather:astronomy").item(0).Attributes["sunrise"].Value;但到目前为止还没有起作用。:'(谢谢。
发布于 2009-07-05 08:10:43
名称空间有一个特殊的getElementsByTagName版本:getElementsByTagNameNS。
例如:
var response = transport.responseXML.getElementsByTagName("channel");
var sunrise = response[0].getElementsByTagNameNS("[Namespace URI]", "astronomy")[0].getAttribute("sunrise");...where [Namespace URI]是yweather命名空间的URI。
史蒂夫
https://stackoverflow.com/questions/1083565
复制相似问题