Bugs in REXML::Document
-----------------------
Key: JRUBY-2487
URL: http://jira.codehaus.org/browse/JRUBY-2487
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.1RC1
Reporter: Eric Armstrong
--------------------------------------------------------------
1. Runtime bug when attempting to pretty-print
document.rb:
def write( output=$stdout, indent=-1, trans=false, ie_hack=false )
^^^^^^^^^^^^^^
if xml_decl.encoding != "UTF-8" && !output.kind_of?(Output)
output = Output.new( output, xml_decl.encoding )
end
formatter = if indent > -1
if transitive
^^^^^^^^^^^^
...
Since "transitive" is undefined, you get a runtime error if
you attempt to generate pretty-printed output by specifying
a value greater than -1.
Fix:
def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
--------------------------------------------------------------
2. Invalid comment on write method.
It says
# indent::
# An integer. If -1, no indenting will be used; otherwise, the
# indentation will be twice this number of spaces, ...
^^^^^^^^^^^^
It should say:
# indent::
# An integer. If -1, no indenting will be used; otherwise, the
# indentation will be this number of spaces, ...
--------------------------------------------------------------
3. Invalid advice for adding a declaration
Comment at the top of document.rb says
# A convenient default XML declaration. If you want an XML declaration,
# ...
# Use: mydoc << XMLDecl.default
But xmldecl.rb says this
# Only use this if you do not want the XML declaration to be written;
# this object is ignored by the XML writer. Otherwise, instantiate your
# own XMLDecl and add it to the document.
#
# Note that XML 1.1 documents *must* include an XML declaration
def XMLDecl.default
rv = XMLDecl.new( "1.0" )
rv.nowrite
rv
end
So the comment should say:
# A convenient default XML declaration. If you want an XML declaration,
# ...
# Use: mydoc << XMLDecl.new( "1.0" )
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email