# File lib/cgikit/parser.rb, line 614
    def buffer2textnode
      if @buf.size > 0
        tn = CGIKit::HTMLParser::TextNode.new(nil)
        o = REXML::Output.new(tn.content, @encoding)
        
        # REXML::Output encodes `@buf` and add its result to `tn.content`

        o << @buf.join('')
        
        @buf.clear
        tn
      else
        nil
      end
    end