From: Love U Ruby Date: 2013-04-15T17:18:49+09:00 Subject: Re: Why does #content method in nokogiri not printing the full text? Bartosz DziewoƄski wrote in post #1105615: > On Sun, 14 Apr 2013 18:19:00 +0200, Love U Ruby > wrote: > >> doc = Nokogiri::HTML::DocumentFragment.parse(html) >> doc.children.each do |ch| >> p ch.content if ch.text? >> end > > `ch.text?` will only return true when a node is a text node - ie., it's > not a tag. Since the document root contains no text itself apart from > whitespace, this just prints the whitespace. Remove the `if ch.text?` > part to print contents of everything (or just use `doc.content`). Thank you very much for your comments. -- Posted via http://www.ruby-forum.com/.