aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/xml_mini/libxml.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-03-10 11:36:25 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-03-10 11:37:23 -0700
commitd4091d3bc79731f55491cfb51c604a66502c944f (patch)
tree4233a75f5c1b962531265ff31ed9edfe7676ab0e /activesupport/lib/active_support/xml_mini/libxml.rb
parente609d83f1a7f49bf8a9549c480a67ee045950336 (diff)
downloadrails-d4091d3bc79731f55491cfb51c604a66502c944f.tar.gz
rails-d4091d3bc79731f55491cfb51c604a66502c944f.tar.bz2
rails-d4091d3bc79731f55491cfb51c604a66502c944f.zip
Properly set up libxml includes. Don't include LibXML in toplevel.
[#2084 state:resolved]
Diffstat (limited to 'activesupport/lib/active_support/xml_mini/libxml.rb')
-rw-r--r--activesupport/lib/active_support/xml_mini/libxml.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/xml_mini/libxml.rb b/activesupport/lib/active_support/xml_mini/libxml.rb
index e1549d8c58..3586b24a6b 100644
--- a/activesupport/lib/active_support/xml_mini/libxml.rb
+++ b/activesupport/lib/active_support/xml_mini/libxml.rb
@@ -1,4 +1,6 @@
-# = XML Mini Libxml implementation
+require 'libxml'
+
+# = XmlMini LibXML implementation
module ActiveSupport
module XmlMini_LibXML #:nodoc:
extend self
@@ -7,19 +9,19 @@ module ActiveSupport
# string::
# XML Document string to parse
def parse(string)
- XML.default_keep_blanks = false
+ LibXML::XML.default_keep_blanks = false
if string.blank?
{}
else
- XML::Parser.string(string.strip).parse.to_hash
+ LibXML::XML::Parser.string(string.strip).parse.to_hash
end
end
end
end
-module XML
+module LibXML
module Conversions
module Document
def to_hash
@@ -37,7 +39,7 @@ module XML
# Hash to merge the converted element into.
def to_hash(hash={})
if text?
- raise RuntimeError if content.length >= LIB_XML_LIMIT
+ raise LibXML::XML::Error if content.length >= LIB_XML_LIMIT
hash[CONTENT_ROOT] = content
else
sub_hash = insert_name_into_hash(hash, name)
@@ -127,5 +129,5 @@ module XML
end
end
-XML::Document.send(:include, XML::Conversions::Document)
-XML::Node.send(:include, XML::Conversions::Node)
+LibXML::XML::Document.send(:include, LibXML::Conversions::Document)
+LibXML::XML::Node.send(:include, LibXML::Conversions::Node)