Changeset 7087
- Timestamp:
- 06/23/07 00:43:11 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1-2-stable/activesupport/CHANGELOG
r6794 r7087 1 1 *SVN* 2 3 * Demote Hash#to_xml to use XmlSimple#xml_in_string so it can't read files or stdin. #8453 [candlerb, Jeremy Kemper] 2 4 3 5 * Document Object#blank?. #6491 [Chris Mear] branches/1-2-stable/activesupport/lib/active_support/core_ext/hash/conversions.rb
r5522 r7087 1 1 require 'date' 2 2 require 'xml_simple' 3 4 # Locked down XmlSimple#xml_in_string 5 class XmlSimple 6 # Same as xml_in but doesn't try to smartly shoot itself in the foot. 7 def xml_in_string(string, options = nil) 8 handle_options('in', options) 9 10 @doc = parse(string) 11 result = collapse(@doc.root) 12 13 if @options['keeproot'] 14 merge({}, @doc.root.name, result) 15 else 16 result 17 end 18 end 19 20 def self.xml_in_string(string, options = nil) 21 new.xml_in_string(string, options) 22 end 23 end 3 24 4 25 module ActiveSupport #:nodoc: … … 82 103 def from_xml(xml) 83 104 # TODO: Refactor this into something much cleaner that doesn't rely on XmlSimple 84 undasherize_keys(typecast_xml_value(XmlSimple.xml_in (xml,105 undasherize_keys(typecast_xml_value(XmlSimple.xml_in_string(xml, 85 106 'forcearray' => false, 86 107 'forcecontent' => true, 87 108 'keeproot' => true, 88 109 'contentkey' => '__content__') 89 )) 110 )) 90 111 end 91 112 92 113 def create_from_xml(xml) 93 114 ActiveSupport::Deprecation.warn("Hash.create_from_xml has been renamed to Hash.from_xml", caller)