class REXML::Formatters::Default

def write( node, output )

change the output encoding.
A class implementing <<. Pass in an Output object to
output::
The node to write
node::

Writes the node to some output.
def write( node, output )
  case node
  when Document
    if node.xml_decl.encoding != 'UTF-8' && !output.kind_of?(Output)
      output = Output.new( output, node.xml_decl.encoding )
    end
    write_document( node, output )
  when Element
    write_element( node, output )
  when Declaration, ElementDecl, NotationDecl, ExternalEntity, Entity,
       Attribute, AttlistDecl
    node.write( output,-1 )
  when Instruction
    write_instruction( node, output )
  when DocType, XMLDecl
    node.write( output )
  when Comment
    write_comment( node, output )
  when CData
    write_cdata( node, output )
  when Text
    write_text( node, output )
  else
    raise Exception.new("XML FORMATTING ERROR")
  end
end