Ticket #31 (closed defect: fixed)
One unescape too many
| Reported by: | Sam Ruby <rubys@…> | Owned by: | anonymous |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1.4 |
| Component: | DOM | Version: | 3.1.2 |
| Severity: | normal | Keywords: | |
| Cc: | Ruby version: | 1.8.2 | |
| Operating system: | Linux |
Description
Here's a test case, contrasting libxml2 and REXML:
require 'test/unit'
class TestCData < Test::Unit::TestCase
@@data = '<title>AT&T</title>'
@@xml = "<description><![CDATA[#{@@data}]]></description>"
def test_libxml2
require 'xml/libxml'
parser = XML::Parser.new
parser.string = @@xml
doc = parser.parse
description = doc.root.find("//description").to_a
assert_equal @@data, description[0].child.content
end
def test_rexml
require 'rexml/document'
doc = REXML::Document.new(@@xml)
description = doc.find {|e| e.name=="description"}
assert_equal @@data, description.text
end
end
Here's my platform info:
rubys@rubypad:~$ ruby -vrrexml/rexml -e 'p REXML::Version,PLATFORM' ruby 1.8.2 (2004-12-25) [i686-linux] "3.1.2.1" "i686-linux"
Change History
Note: See
TracTickets for help on using
tickets.
