diff options
author | Developer <developer@developer.agoramedia.com> | 2009-09-16 14:12:13 -0400 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-09-17 10:28:10 -0700 |
commit | 0d762646c4285437c12ddec9d0938c4ff1c3ef42 (patch) | |
tree | 6a406f6210fc1d5c0d286c85806687b95d0cfc75 /activesupport | |
parent | 23e72d4cc8d879e4d3facac31f96643da48a8a27 (diff) | |
download | rails-0d762646c4285437c12ddec9d0938c4ff1c3ef42.tar.gz rails-0d762646c4285437c12ddec9d0938c4ff1c3ef42.tar.bz2 rails-0d762646c4285437c12ddec9d0938c4ff1c3ef42.zip |
Allow Nokogiri XmlMini backend to process cdata elements
[#3219 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/xml_mini/nokogiri.rb | 2 | ||||
-rw-r--r-- | activesupport/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 847ab0152b..3b2c6a96d9 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 1eeff73d32..e16f36acee 100644 --- a/activesupport/test/xml_mini/nokogiri_engine_test.rb +++ b/activesupport/test/xml_mini/nokogiri_engine_test.rb @@ -159,6 +159,17 @@ class NokogiriEngineTest < Test::Unit::TestCase XmlMini.parse(io) end + def test_children_with_cdata + assert_equal_rexml(<<-eoxml) + <root> + <products> + hello <![CDATA[everyone]]> + morning + </products> + </root> + eoxml + end + private def assert_equal_rexml(xml) hash = XmlMini.with_backend('REXML') { XmlMini.parse(xml) } |