class DataSpork::XmlWriter
Public Instance Methods
begin_put_row()
click to toggle source
# File lib/data_spork/xml_writer.rb, line 28 def begin_put_row print "#{indent}#{begin_row}" end
begin_row()
click to toggle source
Answer the tag defining a row.
# File lib/data_spork/xml_writer.rb, line 59 def begin_row begin_tag(row_tag) end
begin_tag(h = nil)
click to toggle source
Answer a begin tag using the current header, or else override it with the sender’s tag.
# File lib/data_spork/xml_writer.rb, line 49 def begin_tag(h = nil) "<#{h || header}>" end
build_schema_tag()
click to toggle source
Output the schema with the root tag.
# File lib/data_spork/xml_writer.rb, line 15 def build_schema_tag %Q(#{root_tag} #{schema_uri} effective_date="#{effective_date}") end
end_put_row()
click to toggle source
# File lib/data_spork/xml_writer.rb, line 32 def end_put_row print "#{indent}#{end_row}" end
end_row()
click to toggle source
Answer the closing tag for the current row.
# File lib/data_spork/xml_writer.rb, line 64 def end_row end_tag(row_tag) end
end_tag(h = nil)
click to toggle source
Answer the end tag using the current header, or else override it with the sender’s tag.
# File lib/data_spork/xml_writer.rb, line 54 def end_tag(h = nil) "</#{h || header}>" end
finish()
click to toggle source
Close out the XML document.
# File lib/data_spork/xml_writer.rb, line 24 def finish print end_tag root_tag if started? end
indent(level = 1)
click to toggle source
Answer a string prefix for the specified indent level. @param :level specifies the indent level; default is 1.
# File lib/data_spork/xml_writer.rb, line 70 def indent(level = 1) "\t" * level end
put_column()
click to toggle source
Output the current column enclosing it with XML tags.
# File lib/data_spork/xml_writer.rb, line 44 def put_column print "#{indent 2}#{begin_tag}#{col_value}#{end_tag}" end
put_tag(tag, value)
click to toggle source
Output the value enclosing it with the specified XML tag. @param :tag the xml tag name @param :value the value to output
# File lib/data_spork/xml_writer.rb, line 39 def put_tag(tag, value) print "#{indent 2}#{begin_tag tag}#{value || ''}#{end_tag tag}" end
schema_uri()
click to toggle source
# File lib/data_spork/xml_writer.rb, line 19 def schema_uri %q(xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance") end
start_document()
click to toggle source
Output the XML document preface.
# File lib/data_spork/xml_writer.rb, line 4 def start_document print '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>' start_schema end
start_schema()
click to toggle source
Output the schema with the root tag.
# File lib/data_spork/xml_writer.rb, line 10 def start_schema print begin_tag(build_schema_tag) end