使用自定义命名空间在 Ruby 中解析 ATOM
我正在尝试阅读此 ATOM Feed (http://ffffound.com/feed),但我'我无法获取定义为命名空间一部分的任何值,例如媒体:内容和媒体:缩略图。
我需要让解析器了解名称空间吗?
这是我所得到的:
require 'rss/2.0'
require 'open-uri'
source = "http://ffffound.com/feed"
content = ""
open(source) do |s| content = s.read end
rss = RSS::Parser.parse(content, false)
I'm trying to read this ATOM Feed (http://ffffound.com/feed), but I'm unable to get to any of the values which are defined as part of the namespace e.g. media:content and media:thumbnail.
Do I need to make the parser aware of the namespaces?
Here's what I 've got:
require 'rss/2.0'
require 'open-uri'
source = "http://ffffound.com/feed"
content = ""
open(source) do |s| content = s.read end
rss = RSS::Parser.parse(content, false)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信你必须使用 libxml-ruby 来实现这一点。
我希望这能为您指明正确的方向。
I believe you would have to use libxml-ruby for that.
I hope that points you in the right direction.