class REXML::Formatters::Conservative
The Conservative
formatter writes an XML document that parses to an identical document as the source document. This means that no extra whitespace nodes are inserted, and whitespace within text nodes is preserved. Attributes are not sorted.
Public Class Methods
new()
click to toggle source
# File lib/kramdown-rfc/rexml-formatters-conservative.rb, line 10 def initialize @indentation = 0 @level = 0 @ie_hack = false end
Protected Instance Methods
write_element( node, output )
click to toggle source
# File lib/kramdown-rfc/rexml-formatters-conservative.rb, line 17 def write_element( node, output ) output << "<#{node.expanded_name}" node.attributes.each_attribute do |attr| output << " " attr.write( output ) end unless node.attributes.empty? if node.children.empty? output << "/" else output << ">" node.children.each { |child| write( child, output ) } output << "</#{node.expanded_name}" end output << ">" end