Class: Aws::Xml::Parser::RexmlEngine Private

Inherits:
Object
  • Object
show all
Includes:
REXML::StreamListener
Defined in:
lib/aws-sdk-core/xml/parser/engines/rexml.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(stack) ⇒ RexmlEngine

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RexmlEngine.



11
12
13
14
# File 'lib/aws-sdk-core/xml/parser/engines/rexml.rb', line 11

def initialize(stack)
  @stack = stack
  @depth = 0
end

Instance Method Details

#parse(xml) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
22
23
# 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) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
40
# 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) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
28
29
30
31
# 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) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
# File 'lib/aws-sdk-core/xml/parser/engines/rexml.rb', line 33

def text(value)
  @stack.text(value) if @depth > 0
end