P
Phlip
Rubies:
REXML can't escape & properly:
require 'test/unit'
require 'rexml/document'
include REXML
class RexmlIssue < Test::Unit::TestCase
def test_transmitHTMLescapes()
doc = Document.new('<zone/>')
zone = XPath.first(doc, '/zone')
zone.text = '< > >'
File.open('sample.xml', 'w') {|fh| doc.write(fh) }
sample = File.read('sample.xml')
assert_equal '<zone>< > &gt;</zone>', sample
end
end
When I feed REXML > in clear text, it does not expand that into
&gt;.
So when we read zone.text back, we get '< > >', not '< > >' again.
I have a patch in my code - I just call a generic escapeHTML() before
stuffing the node's text. But naturally a real fix would be welcome.
REXML can't escape & properly:
require 'test/unit'
require 'rexml/document'
include REXML
class RexmlIssue < Test::Unit::TestCase
def test_transmitHTMLescapes()
doc = Document.new('<zone/>')
zone = XPath.first(doc, '/zone')
zone.text = '< > >'
File.open('sample.xml', 'w') {|fh| doc.write(fh) }
sample = File.read('sample.xml')
assert_equal '<zone>< > &gt;</zone>', sample
end
end
When I feed REXML > in clear text, it does not expand that into
&gt;.
So when we read zone.text back, we get '< > >', not '< > >' again.
I have a patch in my code - I just call a generic escapeHTML() before
stuffing the node's text. But naturally a real fix would be welcome.