Joshua Muheim wrote: > Hi all > > I want to walk with Nokogiri through the whole DOM of an HTML document > and want to do some stuff to the elements; then save the whole DOM again > (with the changes applied). > > I need something like that: > > dom.each do |tag| > if tag.type == "a" > # do some stuff to links! > if tag.type == "p" > # do some stuff to paragraphs > if ... > end > end > > Sadly I don't really know how to do this, I'm not very used to XPath and > stuff... >
Do you really want to do it this way? Why not do an XPath query that selects and processes all <a>, then another one for all <p>? > Thanks > Josh Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

