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 25
25:     def initialize
26:       @elements = []
27:     end

Public Instance Methods

<<(element) click to toggle source

Add a top-level XMLElement.

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

Produce the XMLDocument as String.

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

Write the XMLDocument to the specified file.

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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.