Afficher un message
Vieux 13/09/2007, 21h53   #4
nutsmuggler
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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

  Réponse avec citation
 
Page generated in 0,04780 seconds with 9 queries