Method: OXM::SaxHandler#end_element

Defined in:
lib/oxm/sax_handler.rb

#end_element(tag) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/oxm/sax_handler.rb', line 48

def end_element tag
  unless @objects.empty?
    obj = @objects.pop

    # Strip content
    if obj.cdata?
      obj.cdata = obj.to_s.strip
    else
      obj.content = obj.to_s.strip
    end
    obj.content = nil if obj.to_s.empty?

    if match?
      if @block
        @block.call obj
      else
        @outputs << obj
      end
      @object = nil
    else
      @object = @objects.last
    end
  end
  @tags.pop
end