    # File lib/nokogiri/xml/node.rb, line 728
          def serialize *args, &block
            options = args.first.is_a?(Hash) ? args.shift : {
              :encoding   => args[0],
              :save_with  => args[1]
            }

            encoding = options[:encoding] || document.encoding
            options[:encoding] = encoding

            outstring = ""
            if encoding && outstring.respond_to?(:force_encoding)
              outstring.force_encoding(Encoding.find(encoding))
            end
            io = StringIO.new(outstring)
            write_to io, options, &block
            io.string
          end