开发者

Using Firefox XML DOM to parse XML(RSS)

Any example on how to parse/have access to simple RSS feed elements in JS? I don't want to 开发者_运维百科use any Microsoft specific objects.


If you have XML in a string, you can parse it using the following in Firefox:

var xmlStr = "<test>Hello world</test>";
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(xmlStr, "text/xml");
alert(xmlDoc.documentElement.nodeName);

If you've got your XML from an XMLHttpRequest, the responseXML property of the request will be a reference to an XML document.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜