On Wed, Mar 13, 2013 at 12:58 PM, Joel Pearson <[email protected]> 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/
--
[email protected] |
https://groups.google.com/d/forum/ruby-talk-google?hl=en
---
You received this message because you are subscribed to the Google Groups
"ruby-talk-google" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.