Class: REXML::Formatters::Default
- Inherits:
-
Object
- Object
- REXML::Formatters::Default
- Defined in:
- lib/rexml/formatters/default.rb
Instance Method Summary (collapse)
-
- (Default) initialize(ie_hack = false)
constructor
Prints out the XML document with no formatting -- except if id_hack is set.
-
- (Object) write(node, output)
Writes the node to some output.
Constructor Details
- (Default) initialize(ie_hack = false)
Prints out the XML document with no formatting -- except if id_hack is set.
ie_hack |
If set to true, then inserts whitespace before the close of an empty tag, so that IE's bad XML parser doesn't choke. |
10 11 12 |
# File 'lib/rexml/formatters/default.rb', line 10 def initialize( ie_hack=false ) @ie_hack = ie_hack end |
Instance Method Details
- (Object) write(node, output)
Writes the node to some output.
node |
The node to write |
output |
A class implementing <<. Pass in an Output object to change the output encoding. |
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rexml/formatters/default.rb', line 21 def write( node, output ) case node when Document if node.xml_decl.encoding != "UTF-8" && !output.kind_of?(Output) output = Output.new( output, node.xml_decl.encoding ) end write_document( node, output ) when Element write_element( node, output ) when Declaration, ElementDecl, NotationDecl, ExternalEntity, Entity, Attribute, AttlistDecl node.write( output,-1 ) when Instruction write_instruction( node, output ) when DocType, XMLDecl node.write( output ) when Comment write_comment( node, output ) when CData write_cdata( node, output ) when Text write_text( node, output ) else raise Exception.new("XML FORMATTING ERROR") end end |