<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>activesupport/lib/active_support/xml_mini.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,137 +1,23 @@
 require 'date'
-
-# = XmlMini
-# This is a derivitive work of XmlSimple 1.0.11
-# Author::    Joseph Holsten &lt;joseph@josephholsten.com&gt;
-# Copyright:: Copyright (c) 2008 Joseph Holsten
-# Copyright:: Copyright (c) 2003-2006 Maik Schmidt &lt;contact@maik-schmidt.de&gt;
-# License::   Distributes under the same terms as Ruby.
-class XmlMini
-  require 'rexml/document'
-  include REXML
-
-  CONTENT_KEY = '__content__'
-
-  # Parse an XML Document string into a simple hash
-  #
-  # Same as XmlSimple::xml_in but doesn't shoot itself in the foot,
-  # and uses the defaults from ActiveSupport
-  #
-  # string::
-  #   XML Document string to parse
-  #
-  def self.parse(string)
-    doc = REXML::Document.new(string)
-    merge_element!({}, doc.root)
-  end
-
-  private
-  # Convert an XML element and merge into the hash
-  #
-  # hash::
-  #   Hash to merge the converted element into.
-  # element::
-  #   XML element to merge into hash
-  def self.merge_element!(hash, element)
-    merge!(hash, element.name, collapse(element))
-  end
-
-  # Actually converts an XML document element into a data structure.
-  #
-  # element::
-  #   The document element to be collapsed.
-  def self.collapse(element)
-    hash = get_attributes(element)
-
-    if element.has_elements?
-      element.each_element {|child| merge_element!(hash, child) }
-      merge_texts!(hash, element) unless empty_content?(element)
-    else
-      return merge_texts!(hash, element)
-    end
-    hash
-  end
-
-  # Merge all the texts of an element into the hash
-  #
-  # hash::
-  #   Hash to add the converted emement to.
-  # element::
-  #   XML element whose texts are to me merged into the hash
-  def self.merge_texts!(hash, element)
-    unless element.has_text?
-      hash
-    else
-      # must use value to prevent double-escaping
-      text_values = element.texts.map {|t| t.value }
-      merge!(hash, CONTENT_KEY, text_values.join)
-    end
-  end
-
-  # Adds a new key/value pair to an existing Hash. If the key to be added
-  # already exists and the existing value associated with key is not
-  # an Array, it will be wrapped in an Array. Then the new value is
-  # appended to that Array.
-  #
-  # hash::
-  #   Hash to add key/value pair to.
-  # key::
-  #   Key to be added.
-  # value::
-  #   Value to be associated with key.
-  def self.merge!(hash, key, value)
-    if hash.has_key?(key)
-      if hash[key].instance_of?(Array)
-        hash[key] &lt;&lt; value
-      else
-        hash[key] = [ hash[key], value ]
-      end
-    elsif value.instance_of?(Array)
-      hash[key] = [ value ]
-    else
-      hash[key] = value
-    end
-    hash
-  end
-
-  # Converts the attributes array of an XML element into a hash.
-  # Returns an empty Hash if node has no attributes.
-  #
-  # element::
-  #   XML element to extract attributes from.
-  def self.get_attributes(element)
-    attributes = {}
-    element.attributes.each { |n,v| attributes[n] = v }
-    attributes
-  end
-
-  # Determines if a document element has text content
-  #
-  # element::
-  #   XML element to be checked.
-  def self.empty_content?(element)
-    element.texts.join.strip.empty?
-  end
-end
-
-# This module exists to decorate files deserialized using Hash.from_xml with
-# the &lt;tt&gt;original_filename&lt;/tt&gt; and &lt;tt&gt;content_type&lt;/tt&gt; methods.
-module FileLike #:nodoc:
-  attr_writer :original_filename, :content_type
-
-  def original_filename
-    @original_filename || 'untitled'
-  end
-
-  def content_type
-    @content_type || 'application/octet-stream'
-  end
-end
+require 'active_support/xml_mini'
 
 module ActiveSupport #:nodoc:
   module CoreExtensions #:nodoc:
     module Hash #:nodoc:
       module Conversions
+        # This module exists to decorate files deserialized using Hash.from_xml with
+        # the &lt;tt&gt;original_filename&lt;/tt&gt; and &lt;tt&gt;content_type&lt;/tt&gt; methods.
+        module FileLike #:nodoc:
+          attr_writer :original_filename, :content_type
+
+          def original_filename
+            @original_filename || 'untitled'
+          end
+
+          def content_type
+            @content_type || 'application/octet-stream'
+          end
+        end
 
         XML_TYPE_NAMES = {
           &quot;Symbol&quot;     =&gt; &quot;symbol&quot;,</diff>
      <filename>activesupport/lib/active_support/core_ext/hash/conversions.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d1213fa4024143edaa060ee0ed326d9d2fcbe919</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Kemper</name>
    <login>jeremy</login>
    <email>jeremy@bitsweat.net</email>
  </author>
  <url>http://github.com/rails/rails/commit/b7fef2610b239db923909cc0fbfc33e6080fe0c4</url>
  <id>b7fef2610b239db923909cc0fbfc33e6080fe0c4</id>
  <committed-date>2008-11-25T23:37:10-08:00</committed-date>
  <authored-date>2008-11-25T23:37:10-08:00</authored-date>
  <message>Extract XmlMini. Namespace FileLike extension.</message>
  <tree>72b443eb0b8f443c73153ec4b9614a45762e4e06</tree>
  <committer>
    <name>Jeremy Kemper</name>
    <login>jeremy</login>
    <email>jeremy@bitsweat.net</email>
  </committer>
</commit>
