99
99
# Where to write the string
101
# An integer. If -1, no indenting will be used; otherwise, the
101
# An integer. If -1, no indentation will be used; otherwise, the
102
102
# indentation will be this number of spaces, and children will be
103
103
# indented an additional amount.
105
# If transitive is true and indent is >= 0, then the output will be
106
# pretty-printed in such a way that the added whitespace does not affect
107
# the absolute *value* of the document -- that is, it leaves the value
108
# and number of Text nodes in the document unchanged.
110
# Internet Explorer is the worst piece of crap to have ever been
111
# written, with the possible exception of Windows itself. Since IE is
112
# unable to parse proper XML, we have to provide a hack to generate XML
113
# that IE's limited abilities can handle. This hack inserts a space
114
# before the /> on empty tags.
116
108
def write( output, indent=0, transitive=false, ie_hack=false )
109
f = REXML::Formatters::Default.new
117
110
indent( output, indent )
121
114
output << " #@external_id" if @external_id
122
output << " #@long_name" if @long_name
123
output << " #@uri" if @uri
115
output << " #{@long_name.inspect}" if @long_name
116
output << " #{@uri.inspect}" if @uri
124
117
unless @children.empty?
125
118
next_indent = indent + 1
127
120
child = nil # speed
128
121
@children.each { |child|
130
child.write( output, next_indent )
123
f.write( child, output )
132
#output << ' '*next_indent