Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 rake 任务中使用 xml-simple gem 来解析 db 转储的内容。问题是数据库 xml 文件包含导致 xml-simple 崩溃的标题中的字符。有解决办法吗?
Nokogiri 似乎有效:
require 'nokogiri' xml =<<ENDOFxML <test> <first_name>João</first_name> </test> ENDOFxML doc = Nokogiri::XML.parse(xml) doc.xpath('//first_name').each do |node| puts node.inner_text end #Output: João