Parent

Methods

Class Index [+]

Quicksearch

TaskJuggler::XMLDocument

This class provides a rather simple XML document generator. It provides basic features to create a tree of XMLElements and to generate a XML String or file. It’s much less powerful than REXML but provides a more efficient API to create XMLDocuments with lots of attributes.

Public Class Methods

new() click to toggle source

Create an empty XML document.

    # File lib/XMLDocument.rb, line 24
24:     def initialize
25:       @elements = []
26:     end

Public Instance Methods

<<(element) click to toggle source

Add a top-level XMLElement.

    # File lib/XMLDocument.rb, line 29
29:     def <<(element)
30:       @elements << element
31:     end
to_s() click to toggle source

Produce the XMLDocument as String.

    # File lib/XMLDocument.rb, line 34
34:     def to_s
35:       str = ''
36:       @elements.each do |element|
37:         str << element.to_s(0)
38:       end
39: 
40:       str
41:     end
write(filename) click to toggle source

Write the XMLDocument to the specified file.

    # File lib/XMLDocument.rb, line 44
44:     def write(filename)
45:       f = filename == '.' ? $stdout : File.new(filename.untaint, 'w')
46:       @elements.each do |element|
47:         f.puts element.to_s(0)
48:       end
49:       f.close unless f == $stdout
50:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.