Delicious feed 的 jQuery RSS 解析问题
我正在尝试解析我的美味链接提要来生成自定义 html。我无法解析 item.link 和 item.creator (以下 rss 的索引 3,4)。
<代码>
美味/我的用户名 http://www.delicious.com/myusername 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”的文本区域获取 rss 输入,并尝试在 firebug 控制台中打印链接。
feed = $('#rss').val();
$(feed).find('item').each(function(){ console.log($(this).children().eq(3).text());
});
由于某种原因,完整的 xml 未正确呈现,这里是美味提要的 Pastebin 链接 http://pastebin.com/KbDNyL0P
更新: 看来我使用了错误的 jQuery 版本/发行版,我从导致问题的插件目录复制了 jQuery。经验教训:始终从 jQuery/GoogleCode 网站下载。
I'm trying to parse my delicious links feed to generate custom html. I was not able to parse the item.link and item.creator (index 3,4 of the following rss).
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>
here is my jQuery code, i take rss input from textarea with id "rss" and trying to print the link in firebug console.
feed = $('#rss').val();
$(feed).find('item').each(function(){
console.log($(this).children().eq(3).text());
});
For some reason the complete xml is not rendered correctly, here is the pastebin link of delicious feed http://pastebin.com/KbDNyL0P
Update:
It seems that I was using some wrong version/distro of jQuery, I copied jQuery from a plugin directory that causes the issue. Lesson learnt: always download from jQuery/GoogleCode site.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 json
http://feeds.delicious.com/v2/json/myusername?计数=15
Try using json
http://feeds.delicious.com/v2/json/myusername?count=15