From d14c4863b35a3710b76c8399db4c8455ff142486 Mon Sep 17 00:00:00 2001 From: Developer Date: Wed, 16 Sep 2009 14:12:13 -0400 Subject: [PATCH] Allow Nokogiri XmlMini backend to process cdata elements --- .../lib/active_support/xml_mini/nokogiri.rb | 2 +- .../test/xml_mini/nokogiri_engine_test.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/activesupport/lib/active_support/xml_mini/nokogiri.rb b/activesupport/lib/active_support/xml_mini/nokogiri.rb index 847ab01..3b2c6a9 100644 --- a/activesupport/lib/active_support/xml_mini/nokogiri.rb +++ b/activesupport/lib/active_support/xml_mini/nokogiri.rb @@ -44,7 +44,7 @@ module ActiveSupport walker = lambda { |memo, parent, child, callback| next if child.blank? && 'file' != parent['type'] - if child.text? + if child.text? || child.cdata? (memo[CONTENT_ROOT] ||= '') << child.content next end diff --git a/activesupport/test/xml_mini/nokogiri_engine_test.rb b/activesupport/test/xml_mini/nokogiri_engine_test.rb index 1eeff73..47b4eaf 100644 --- a/activesupport/test/xml_mini/nokogiri_engine_test.rb +++ b/activesupport/test/xml_mini/nokogiri_engine_test.rb @@ -158,6 +158,17 @@ class NokogiriEngineTest < Test::Unit::TestCase eoxml XmlMini.parse(io) end + + def test_children_with_cdata + assert_equal_rexml(<<-eoxml) + + + hello + morning + + + eoxml + end private def assert_equal_rexml(xml) -- 1.6.3.1