Paradise Regained
Jacques Distler: In theory, the result of serializing a REXML tree is well-formed XML.
begin
require 'rexml/document'
foo = REXML::Document.new("<div>a�b</div>")
bar = REXML::Formatters::Default.new
out = String.new
bar.write(foo, out)
puts out
rescue REXML::ParseException => e
puts e.continued_exception.message
end
It is quite possible to produce a DOM that can’t be serialized into well-formed XML, but I do agree that if one parses a document without error, one should be confident that the document produced by serializing that document is well-formed.
With this ticket fixed, the above code now produces:
Illegal character '�' in raw string "a�b"
“quite possible to produce a DOM that can’t be serialized into well-formed XML”.
Is that a REXML criticism? I’m reasonably certain XOM doesn’t allow that. Would there be any benefit in mining some of the XOM test cases for REXML?
Posted by James Abley at
The Ruby News
I keep putting off this Ruby News Survey piece because there keeps being more news, but hey, you have to pull the trigger sometime....Excerpt from ongoing at