diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-09 12:46:06 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-09 13:00:57 -0700 |
commit | 87d82ef76e88d7ce97cfc09151b677b552f2840a (patch) | |
tree | 5ce0f6147cb0da934e658b181546a72b473021b2 /activesupport/lib/active_support/xml_mini/libxml.rb | |
parent | 146511e0181a8c6703dcff7b5236d81b64841dd5 (diff) | |
download | rails-87d82ef76e88d7ce97cfc09151b677b552f2840a.tar.gz rails-87d82ef76e88d7ce97cfc09151b677b552f2840a.tar.bz2 rails-87d82ef76e88d7ce97cfc09151b677b552f2840a.zip |
Require libxml-ruby 0.9.4 or 0.9.7 pending a segfault bugfix for 1.0.
Delegate parsing to a switchable backend.
Diffstat (limited to 'activesupport/lib/active_support/xml_mini/libxml.rb')
-rw-r--r-- | activesupport/lib/active_support/xml_mini/libxml.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/xml_mini/libxml.rb b/activesupport/lib/active_support/xml_mini/libxml.rb index dd271dc587..e1549d8c58 100644 --- a/activesupport/lib/active_support/xml_mini/libxml.rb +++ b/activesupport/lib/active_support/xml_mini/libxml.rb @@ -1,19 +1,19 @@ # = XML Mini Libxml implementation module ActiveSupport - module XmlMini + module XmlMini_LibXML #:nodoc: extend self # Parse an XML Document string into a simple hash using libxml. # string:: # XML Document string to parse def parse(string) - require 'xml/libxml' unless defined? LibXML - - string.strip! XML.default_keep_blanks = false - return {} if string.blank? - return XML::Parser.string(string).parse.to_hash + if string.blank? + {} + else + XML::Parser.string(string.strip).parse.to_hash + end end end @@ -128,4 +128,4 @@ module XML end XML::Document.send(:include, XML::Conversions::Document) -XML::Node.send(:include, XML::Conversions::Node)
\ No newline at end of file +XML::Node.send(:include, XML::Conversions::Node) |