> > doc1=x.gsub(/<(\/?)li><span>/,'</li></see><see><span>') > doc2=Hpricot(doc1.to_s)
doc1 is only a string, so: A) doc1 is misleading in this context and I'd use a different variable name, and B) doc1.to_s is superfluous processing in the Hpricot call If you want to process all the 'Kolkata's, then don't do the if/end. Encountering a div in '(doc2/"see").each do |dv|' should force the creation of a new LandMarkType element since you have only one span per div. This creates the container to nest all your other data (from the li items) for that landmark type. My earlier example picking out only 1 span to work on was to show that once the span/li sets were properly wrapped with divs, you could process a specific one if you wanted to. If you want them all, just iterate without the selection. Slow down and ponder the code you write, understanding the 'why' of what you do. Don't just type in other stuff blindly, because at the end of the day, what have you learned? Real knowledge isn't solving just this problem, it's learning a new tool that you can apply to a different situation, which requires understanding why something worked. -- 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 -~----------~----~----~----~------~----~------~--~---

