Re: Bypassing XML inconsistencies with REXML::StreamListener
hpricot is my man :-)
Being an HTML parser, it's much less hard to please.
Here is the basic code I am using:
require 'rubygems'
require 'hpricot'
doc = Hpricot.XML(open("bch01aad006_MEMORIA.EXP"))
doc.search("Source").each do |item|
if item.innerHTML =~ /firmware/
puts "EN: #{item}"
puts "IT: #{item.next_sibling}"
end
end
The principle it's quite easy, and much more coincise than the rexml
solution.
Thanks a million for the tip.
Davide
|