I am using the xml-simple gem inside a rake task to parse the contents of a db dump. The problem is that the database xml file contains characters like those in the title that causes xml-simple to crash. Is there a work around to this?
+2
A:
Nokogiri seems to work:
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
Mark Thomas
2010-09-03 01:34:16