From: Love U Ruby Date: 2013-04-15T01:19:00+09:00 Subject: Why does #content method in nokogiri not printing the full text? Here is the documentation: http://www.rubydoc.info/gems/nokogiri/frames Why does below code not printing the full text? Code: ====== require 'nokogiri' html = <<-END A Dirge

            Rough wind, that moanest loud
              Grief too sad for song;
            Wild wind, when sullen cloud
              Knells all the night long;
            Sad storm, whose tears are vain,
            Bare woods, whose branches strain,
            Deep caves and dreary main, -
              Wail, for the world's wrong!

    
END doc = Nokogiri::HTML::DocumentFragment.parse(html) doc.children.each do |ch| p ch.content if ch.text? end Output: ======== "\n\n \n\n " "\n\n " Expected output: ================ Rough wind, that moanest loud Grief too sad for song; Wild wind, when sullen cloud Knells all the night long; Sad storm, whose tears are vain, Bare woods, whose branches strain, Deep caves and dreary main, - Wail, for the world's wrong! -- Posted via http://www.ruby-forum.com/.