Hello.
How can I remove img tag/s using nokogiri?
I have the following code but it wont work:
f = Nokogiri::XML.fragment(str)
f.search('//img').each do |node|
node.remove
end
puts f
Thanks for help!
Hello.
How can I remove img tag/s using nokogiri?
I have the following code but it wont work:
f = Nokogiri::XML.fragment(str)
f.search('//img').each do |node|
node.remove
end
puts f
Thanks for help!
have a try!
f = Nokogiri::XML.fragment(str)
f.search('.//img').remove puts f