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

        io = StringIO.new
        write_to io, options, &block
        io.rewind
        io.read
      end