Allow Nokogiri XmlMini backend to process cdata elements

[#3219 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
This commit is contained in:
Developer
2009-09-16 14:12:13 -04:00
committed by Jeremy Kemper
parent 23e72d4cc8
commit 0d762646c4
2 changed files with 12 additions and 1 deletions

View File

@@ -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

View File

@@ -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) }