~ubuntu-branches/ubuntu/intrepid/ruby1.9/intrepid-updates

« back to all changes in this revision

Viewing changes to lib/rexml/doctype.rb

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-09-04 16:01:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070904160117-i15zckg2nhxe9fyw
Tags: 1.9.0+20070830-2ubuntu1
* Sync from Debian; remaining changes:
  - Add -g to CFLAGS.
* Fixes build failure on ia64.
* Fixes build failure with gcc-4.2 on lpia.
* Robustify check for target_os, fixing build failure on lpia.
* Set Ubuntu maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
    # output::
99
99
    #   Where to write the string
100
100
    # indent::
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.
104
104
    # transitive::
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.
 
105
    #   Ignored
109
106
    # ie_hack::
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.
115
 
    #
 
107
    #   Ignored
116
108
    def write( output, indent=0, transitive=false, ie_hack=false )
 
109
      f = REXML::Formatters::Default.new
117
110
      indent( output, indent )
118
111
      output << START
119
112
      output << ' '
120
113
      output << @name
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
126
119
        output << ' ['
127
120
        child = nil    # speed
128
121
        @children.each { |child|
129
122
          output << "\n"
130
 
          child.write( output, next_indent )
 
123
          f.write( child, output )
131
124
        }
132
 
        #output << '   '*next_indent
133
125
        output << "\n]"
134
126
      end
135
127
      output << STOP
219
211
      @string+'>'
220
212
    end
221
213
 
 
214
    # == DEPRECATED
 
215
    # See REXML::Formatters
 
216
    #
222
217
    def write( output, indent )
223
 
      output << ('   '*indent) if indent > 0
224
218
      output << to_s
225
219
    end
226
220
  end
264
258
    end
265
259
 
266
260
    def write( output, indent=-1 )
267
 
      output << ('   '*indent) if indent > 0
268
261
      output << to_s
269
262
    end
270
263