def write(output, include_root = false)
      if output.is_a? String
        io = StringIO.new(output)
        close_io = true # indicates we close the IO ourselves
      elsif output.is_a? IO or output.is_a? StringIO
        io = output
        close_io = false # let the caller close the IO
      else
        raise ArgumentError, "'output' should be a String or an IO but was #{output.class}"
      end
      
      if include_root
        io << to_s
      else
        first = true
        children do |child|
          io << $/ unless first
          first = false
          io << child.to_s
        end
      end
      
      io.close() if close_io

      output
    end
def write(output, include_root = false)
      if output.is_a? String
        io = StringIO.new(output)
        close_io = true # indicates we close the IO ourselves
      elsif output.is_a? IO or output.is_a? StringIO
        io = output
        close_io = false # let the caller close the IO
      else
        raise ArgumentError, "'output' should be a String or an IO but was #{output.class}"
      end
      
      if include_root
        io << to_s
      else
        first = true
        children do |child|
          io << $/ unless first
          first = false
          io << child.to_s
        end
      end
      
      io.close() if close_io

      output
    end
Write this tag out to the given IO or StringIO or String (optionally clipping the root.)
 Returns +output+.

 _output_:: an IO or StringIO or a String to write to
 +include_root+:: if true this tag will be written out as the root element, if false only the
   children will be written. False by default.