class Aws::Xml::Parser::RexmlEngine

Public Class Methods

new(stack) click to toggle source
# File lib/aws-sdk-core/xml/parser/engines/rexml.rb, line 11
def initialize(stack)
  @stack = stack
  @depth = 0
end

Public Instance Methods

parse(xml) click to toggle source
# File lib/aws-sdk-core/xml/parser/engines/rexml.rb, line 16
def parse(xml)
  begin
    source = REXML::Source.new(xml)
    REXML::Parsers::StreamParser.new(source, self).parse
  rescue REXML::ParseException => error
    @stack.error(error.message)
  end
end
tag_end(name) click to toggle source
# File lib/aws-sdk-core/xml/parser/engines/rexml.rb, line 37
def tag_end(name)
  @stack.end_element
  @depth -= 1
end
tag_start(name, attrs) click to toggle source
# File lib/aws-sdk-core/xml/parser/engines/rexml.rb, line 25
def tag_start(name, attrs)
  @depth += 1
  @stack.start_element(name)
  attrs.each do |attr|
    @stack.attr(*attr)
  end
end
text(value) click to toggle source
# File lib/aws-sdk-core/xml/parser/engines/rexml.rb, line 33
def text(value)
  @stack.text(value) if @depth > 0
end