class LANSA::XML::DocumentBuilder
Attributes
writer[R]
Public Class Methods
new(writer, transformer)
click to toggle source
# File xml/transformer.rb, line 85 def initialize writer, transformer @writer = writer @transformer = transformer @element_name = nil @element_attrs = nil end
Public Instance Methods
attribute(name, value)
click to toggle source
# File xml/transformer.rb, line 101 def attribute name, value raise 'Can\'t write attribute without element' unless @element_attrs @element_attrs << Attr.new(name, nil, value) end
cdata(content)
click to toggle source
# File xml/transformer.rb, line 106 def cdata content write_element_start @writer.cdata_block content end
comment(content)
click to toggle source
# File xml/transformer.rb, line 116 def comment content write_element_start @writer.comment content end
element(name, &block)
click to toggle source
# File xml/transformer.rb, line 92 def element name, &block write_element_start @element_name = name @element_attrs = [] block.call write_element_start @writer.end_element_namespace name end
text(content)
click to toggle source
# File xml/transformer.rb, line 111 def text content write_element_start @writer.characters content end