class REXML::Element

def write(output=$stdout, indent=-1, transitive=false, ie_hack=false)

doc.write( $stdout ) #-> doc written to the console
doc.write( out ) #-> doc is written to the string 'out'
out = ''

a limitation of Internet Explorer. Defaults to false
This hack inserts a space before the /> on empty tags to address
ie_hack::
the parse tree of the document
pretty-printed in such a way that the added whitespace does not affect
If transitive is true and indent is >= 0, then the output will be
transitive::
indented an additional amount. Defaults to -1
indentation will be this number of spaces, and children will be
An integer. If -1, no indenting will be used; otherwise, the
indent::
document will be written.
output an object which supports '<< string'; this is where the
output::
Writes out this element, and recursively, all children.

See REXML::Formatters
== DEPRECATED
def write(output=$stdout, indent=-1, transitive=false, ie_hack=false)
  Kernel.warn("#{self.class.name}.write is deprecated.  See REXML::Formatters", uplevel: 1)
  formatter = if indent > -1
      if transitive
        require_relative "formatters/transitive"
        REXML::Formatters::Transitive.new( indent, ie_hack )
      else
        REXML::Formatters::Pretty.new( indent, ie_hack )
      end
    else
      REXML::Formatters::Default.new( ie_hack )
    end
  formatter.write( self, output )
end