Christian Neukirchen wrote: > "William James" <w_a_x_man / yahoo.com> writes: > >> class String >> def xtag(s) >> scan( %r! ( < #{s} [^>]* > ) ( .*? ) </ #{s} > !mx ) >> end >> end >> >> gets(nil).xtag("biblioentry").each { |tag,data| >> if data.xtag("pubdate")[0][1] > "1984" >> print tag, data, "\n" >> end >> } > > I hope you are joking... > Actually, in real-world usage, Mark Pilgrim's Python Feed Parser[0] falls back to regular expressions to get the data required if the XML is not well-formed. Admittedly this is a real problem for RSS hackers, less so with other XML messages, but the approach does have merit if (a) you can't guarantee well-formedness and (b) you absolutely have to have the data. -dave [0] http://feedparser.org/