我有一个 blogspot 导出的 xml 文件,它看起来像这样:
<feed>
<entry>
<title> title </title>
<content type="html"> Content </content>
</entry>
<entry>
<title> title </title>
<content type="html"> Content </content>
</entry>
</feed>
如何用 Nokogiri 和 Xpath 解析???
这是我所拥有的:
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
doc = Nokogiri::XML(File.open("blogspot.xml"))
doc.xpath('//content[@type="html"]').each do |node|
puts node.text
end
但它没有给我任何东西:/
有什么建议么?:/