class Glimmer::XML::XmlVisitor
Attributes
document[R]
Public Class Methods
new()
click to toggle source
# File lib/glimmer/xml/xml_visitor.rb, line 31 def initialize @document = "" end
Public Instance Methods
append_attributes(node)
click to toggle source
# File lib/glimmer/xml/xml_visitor.rb, line 76 def append_attributes(node) return if node.name == 'xml' || node.name_space_context? Glimmer::Config.logger&.debug "Take 3" Glimmer::Config.logger&.debug(node.attributes) node.attributes.each do |attribute, value| attribute_name = attribute attribute_name = "#{attribute.name_space.name}:#{attribute.name}" if attribute.is_a?(Node) @document += " #{attribute_name}" @document += "=\"#{value}\"" unless value.nil? end end
append_close_tag(node)
click to toggle source
# File lib/glimmer/xml/xml_visitor.rb, line 67 def append_close_tag(node) return if node.name == 'xml' || node.name_space_context? if (node.contents) @document += "</" @document += "#{node.name_space.name}:" if node.name_space @document += "#{node.name}>" end end
begin_open_tag(node)
click to toggle source
# File lib/glimmer/xml/xml_visitor.rb, line 50 def begin_open_tag(node) return if node.name == 'xml' || node.name_space_context? @document += "<" @document += "#{node.name_space.name}:" if node.name_space @document += node.name end
end_open_tag(node)
click to toggle source
# File lib/glimmer/xml/xml_visitor.rb, line 57 def end_open_tag(node) return if node.name == 'xml' || node.name_space_context? if (node.contents) @document += ">" else @document += " " if node.attributes.keys.size > 0 @document += " />" end end
process_after_children(node)
click to toggle source
# File lib/glimmer/xml/xml_visitor.rb, line 45 def process_after_children(node) return if (!node.is_a?(Glimmer::XML::Node)) append_close_tag(node) end
process_before_children(node)
click to toggle source
# File lib/glimmer/xml/xml_visitor.rb, line 35 def process_before_children(node) if (!node.is_a?(Glimmer::XML::Node)) @document += node.to_s return end begin_open_tag(node) append_attributes(node) if node.attributes end_open_tag(node) end