使用 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;
但到目前为止还没有任何效果。 :'(
谢谢。
有一个特殊版本getElementsByTagName
对于命名空间:getElementsByTagNameNS https://developer.mozilla.org/En/DOM/Element.getElementsByTagNameNS.
例如:
var response = transport.responseXML.getElementsByTagName("channel");
var sunrise = response[0].getElementsByTagNameNS("[Namespace URI]", "astronomy")[0].getAttribute("sunrise");
...在哪里[Namespace URI]
是 URIyweather
命名空间。
Steve
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)