to_hash (REXMLUtilityNode)

    # File lib/extlib/hash.rb, line 297
      def to_hash
        if @type == "file"
          f = StringIO.new((@children.first || '').unpack('m').first)
          class << f
            attr_accessor :original_filename, :content_type
          end
          f.original_filename = attributes['name'] || 'untitled'
          f.content_type = attributes['content_type'] || 'application/octet-stream'
          return {name => f}
        end

        if @text
          return { name => typecast_value( translate_xml_entities( inner_html ) ) }
        else
          #change repeating groups into an array
          groups = @children.inject({}) { |s,e| (s[e.name] ||= []) << e; s }

          out = nil
          if @type == "array"
            out = []
            groups.each do |k, v|
              if v.size == 1
                out << v.first.to_hash.entries.first.last
              else
                out << v.map{|e| e.to_hash[k]}
              end
            end
            out = out.flatten

          else # If Hash
            out = {}
            groups.each do |k,v|
              if v.size == 1
                out.merge!(v.first)
              else
                out.merge!( k => v.map{|e| e.to_hash[k]})
              end
            end
            out.merge! attributes unless attributes.empty?
            out = out.empty? ? nil : out
          end

          if @type && out.nil?
            { name => typecast_value(out) }
          else
            { name => out }
          end
        end
      end