# File temp/document.rb, line 161
    def serialize( formatter = nil )
      if xml_decl.encoding != "UTF-8" && !output.kind_of?(Output) 
        output = Output.new( output, xml_decl.encoding )
      end

      formatter = REXML::Pretty.new( $stdout ) if (formatter.nil?)

                        @children.each { |node|
        puts "node = #{node.inspect}"
                                indent( output, indent ) if node.node_type == :element
                                if node.write( output, indent, transitive, ie_hack )
          output << "\n" unless indent<0 or node == @children[-1]
        end
                        }
    end