Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow Nokogiri XmlMini backend to process cdata elements

[#3219 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
commit 0d762646c4285437c12ddec9d0938c4ff1c3ef42 1 parent 23e72d4
Developer authored jeremy committed
View
2  activesupport/lib/active_support/xml_mini/nokogiri.rb
@@ -44,7 +44,7 @@ def to_hash(hash = {})
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
11 activesupport/test/xml_mini/nokogiri_engine_test.rb
@@ -159,6 +159,17 @@ def test_parse_from_io
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) }
Please sign in to comment.
Something went wrong with that request. Please try again.