mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Allow Nokogiri XmlMini backend to process cdata elements
[#3219 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) }
|
||||
|
||||
Reference in New Issue
Block a user