更新时间:2023-11-24 17:05:04
require 'nokogiri'
doc = Nokogiri::XML(File.open(path))
doc.xpath('//jc').each do |n|
puts n.attr('val')
end
应该可以.不要忘记查看文档:http://nokogiri.org/tutorials/searching_a_xml_html_document.html#fn:1
Should work. Don't forget to look at the docs : http://nokogiri.org/tutorials/searching_a_xml_html_document.html#fn:1