xml_in (XmlSimple)

    # File lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb, line 149
      def xml_in(string = nil, options = nil)
        handle_options('in', options)

        # If no XML string or filename was supplied look for scriptname.xml.
        if string.nil?
          string = File::basename($0)
          string.sub!(/\.[^.]+$/, '')
          string += '.xml'

          directory = File::dirname($0)
          @options['searchpath'].unshift(directory) unless directory.nil?
        end

        if string.instance_of?(String)
          if string =~ /<.*?>/m
            @doc = parse(string)
          elsif string == '-'
            @doc = parse($stdin.readlines.to_s)
          else
            filename = find_xml_file(string, @options['searchpath'])

            if @options.has_key?('cache')
              @options['cache'].each { |scheme|
                case(scheme)
                when 'storable'
                  content = @@cache.restore_storable(filename)
                when 'mem_share'
                  content = @@cache.restore_mem_share(filename)
                when 'mem_copy'
                  content = @@cache.restore_mem_copy(filename)
                else
                  raise ArgumentError, "Unsupported caching scheme: <#{scheme}>."
                end
                return content if content
              }
            end

            @doc = load_xml_file(filename)
          end
        elsif string.kind_of?(IO) || string.kind_of?(StringIO)
          @doc = parse(string.readlines.to_s)
        else
          raise ArgumentError, "Could not parse object of type: <#{string.type}>."
        end

        result = collapse(@doc.root)
        result = @options['keeproot'] ? merge({}, @doc.root.name, result) : result
        put_into_cache(result, filename)
        result
      end