diff options
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/xml_mini/libxmlsax.rb | 14 | ||||
-rw-r--r-- | activesupport/lib/active_support/xml_mini/nokogirisax.rb | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/xml_mini/libxmlsax.rb b/activesupport/lib/active_support/xml_mini/libxmlsax.rb index dba1f8755a..d7b2f4c5be 100644 --- a/activesupport/lib/active_support/xml_mini/libxmlsax.rb +++ b/activesupport/lib/active_support/xml_mini/libxmlsax.rb @@ -21,16 +21,13 @@ module ActiveSupport end def on_start_document - @hash = {} + @hash = { CONTENT_KEY => '' } @hash_stack = [@hash] end def on_end_document - raise "Parse stack not empty!" if @hash_stack.size > 1 - end - - def on_error(error_message) - raise LibXML::XML::Error, error_message + @hash = @hash_stack.pop + @hash.delete(CONTENT_KEY) end def on_start_element(name, attrs = {}) @@ -73,8 +70,11 @@ module ActiveSupport {} else data.ungetc(char) - document = self.document_class.new + + LibXML::XML::Error.set_handler(&LibXML::XML::Error::QUIET_HANDLER) parser = LibXML::XML::SaxParser.io(data) + document = self.document_class.new + parser.callbacks = document parser.parse document.hash diff --git a/activesupport/lib/active_support/xml_mini/nokogirisax.rb b/activesupport/lib/active_support/xml_mini/nokogirisax.rb index 42a44897ba..d538a9110f 100644 --- a/activesupport/lib/active_support/xml_mini/nokogirisax.rb +++ b/activesupport/lib/active_support/xml_mini/nokogirisax.rb @@ -28,7 +28,7 @@ module ActiveSupport end def error(error_message) - raise Nokogiri::XML::SyntaxError, error_message + raise error_message end def start_element(name, attrs = []) |