提交 0d762646 编写于 作者: D Developer 提交者: Jeremy Kemper

Allow Nokogiri XmlMini backend to process cdata elements

[#3219 state:committed]
Signed-off-by: NJeremy Kemper <jeremy@bitsweat.net>
上级 23e72d4c
......@@ -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
......
......@@ -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) }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册