On Wed, Mar 13, 2013 at 12:58 PM, Joel Pearson <lists / ruby-forum.com> wrote:
> I didn't go all exhaustive on it, just a general idea :)
Yes, and you have been shown why regexp is the wrong tool for parsing
SGML heritage - especially when there is something as awesome as
Nokogiri around. :-)
require 'nokogiri'
dom = Nokogiri::XML <<XML
<doc><p id="a124">this is a paragraph</p><ul id="b234567"><li
id="a4563">list item</li></ul></doc>
XML
dom.xpath('//*[@id]').each do |node|
printf "%-10s %s\n", node[:id], node.name
end
Kind regards
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/