我正在尝试解析我的美味链接提要以生成自定义 html。我无法解析 item.link 和 item.creator(以下 rss 的索引 3,4)。
Delicious/myusername
http://www.delicious.com/myusername
bookmarks posted by myusername
<item>
<title>Full-function Core Data example app « Peter McIntyre</title>
<pubDate>Mon, 11 Nov 2005 04:02:00 -0730</pubDate>
<guid isPermaLink="false">http://www.delicious.com/url/8b20ab1d1fa021f744acb67f69e22a36#myusername</guid>
<link>http://petermcintyre.wordpress.com/2010/02/24/full-function-core-data-example-app/</link>
<dc:creator><![CDATA[myusername]]></dc:creator>
<comments>http://www.delicious.com/url/8b20ab1d1fa021f744acb67f69e22a36</comments>
<wfw:commentRss>http://feeds.delicious.com/v2/rss/url/8b20ab1d1fa021f744acb67f69e22a36</wfw:commentRss>
<source url="http://feeds.delicious.com/v2/rss/myusername">myusername's bookmarks</source>
<category domain="http://www.delicious.com/myusername/">iphone,</category>
<category domain="http://www.delicious.com/myusername/">coredata,</category>
</item>
<item>
<title>Is there a high-level gestures library for iPhone development? - Stack Overflow</title>
<pubDate>Fri, 24 Sep 2008 09:19:16 +0730</pubDate>
<guid isPermaLink="false">http://www.delicious.com/url/5082a6b90d2dfecbf9673c3f61e45abc#myusername</guid>
<link>http://stackoverflow.com/questions/907512/is-there-a-high-level-gestures-library-for-iphone-development</link>
<dc:creator><![CDATA[myusername]]></dc:creator>
<comments>http://www.delicious.com/url/5082a6b90d2dfecbf9673c3f61e45abc</comments>
<wfw:commentRss>http://feeds.delicious.com/v2/rss/url/5082a6b90d2dfecbf9673c3f61e45abc</wfw:commentRss>
<source url="http://feeds.delicious.com/v2/rss/myusername">myusername's bookmarks</source>
<category domain="http://www.delicious.com/myusername/">iPhone</category>
<category domain="http://www.delicious.com/myusername/">gesture</category>
<category domain="http://www.delicious.com/myusername/">objc</category>
<category domain="http://www.delicious.com/myusername/">gesture-recognization</category>
</item>
这是我的 jQuery 代码,我从 id 为“rss”的 textarea 获取 rss 输入,并尝试在 firebug 控制台中打印链接。
feed = $('#rss').val();
$(feed).find('item').each(function(){
console.log($(this).children().eq(3).text());
});
由于某种原因,完整的 xml 没有正确呈现,这里是美味饲料http://pastebin.com/KbDNyL0P的 pastebin 链接
更新: 似乎我使用了一些错误的 jQuery 版本/发行版,我从导致问题的插件目录中复制了 jQuery。经验教训:总是从 jQuery/GoogleCode 网站下载。