DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Deleting An Element From Nokogiri

06.04.2010
| 4961 views |
  • submit to reddit
        In this example all img elements are deleted from the Nokogiri HTML document.
doc2.xpath('//img').each {|x| x.remove}
Resources:
 - <a href="http://stackoverflow.com/questions/1274783/inserting-and-deleting-nokogiri-xml-nodes-and-elements">inserting and deleting nokogiri XML nodes and elements - Stack Overflow</a> [stackoverflow.com]