trunke$B$Ne(BREXMLe$B$,85$@$H;W$&$N$G$9$1$Ie(B
REXML::Document.new("").each_child{|e|
e.write($stdout,1,true,true)
e$B$J$I$GNc30$,>e$,$j$^$9!#e(B
e$B$I$3$Ge(Brequiree$B$9$k$H$$$$$N$+J,$+$j$^$;$s$,e(B
e$B$H$j$"$($:$3$s$J$s$G2sHr$G$-$=$&$G$9!#e(B
Index: lib/rexml/document.rb
— lib/rexml/document.rb (revision 13760)
+++ lib/rexml/document.rb (working copy)
@@ -184,7 +184,8 @@
output = Output.new( output, xml_decl.encoding )
end
formatter = if indent > -1
-
if trans
-
if transitive
-
require "rexml/formatters/transitive" REXML::Formatters::Transitive.new( indent, ie_hack ) else REXML::Formatters::Pretty.new( indent, ie_hack )
Index: lib/rexml/element.rb
— lib/rexml/element.rb (revision 13760)
+++ lib/rexml/element.rb (working copy)
@@ -671,10 +671,11 @@
# out = ‘’
# doc.write( out ) #-> doc is written to the string ‘out’
# doc.write( $stdout ) #-> doc written to the console
- def write(writer=$stdout, indent=-1, transitive=false,
ie_hack=false)
- def write(output=$stdout, indent=-1, transitive=false,
ie_hack=false)
Kernel.warn("#{self.class.name}.write is deprecated. See
REXML::Formatters")
formatter = if indent > -1
if transitive -
require "rexml/formatters/transitive" REXML::Formatters::Transitive.new( indent, ie_hack ) else REXML::Formatters::Pretty.new( indent, ie_hack )
Index: lib/rexml/formatters/transitive.rb
— lib/rexml/formatters/transitive.rb (revision 13760)
+++ lib/rexml/formatters/transitive.rb (working copy)
@@ -12,9 +12,10 @@
# formatted. Since this formatter does not alter whitespace nodes,
the
# results of formatting already formatted XML will be odd.
class Transitive < Default
-
def initialize( indentation=2 )
-
def initialize( indentation=2, ie_hack=false ) @indentation = indentation @level = 0
-
@ie_hack = ie_hack end protected
@@ -29,6 +30,7 @@
output << “\n”
output << ’ '*@level
if node.children.empty?
-
output << " " if @ie_hack output << "/" else output << ">"