Class: Aws::Xml::Parser::OgaEngine Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/xml/parser/engines/oga.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) ⇒ OgaEngine

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 OgaEngine.



8
9
10
11
# File 'lib/aws-sdk-core/xml/parser/engines/oga.rb', line 8

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

Instance Method Details

#after_element(_, _) ⇒ 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.



31
32
33
34
# File 'lib/aws-sdk-core/xml/parser/engines/oga.rb', line 31

def after_element(_, _)
  @stack.end_element
  @depth -= 1
end

#on_element(namespace, 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.



19
20
21
22
23
24
25
# File 'lib/aws-sdk-core/xml/parser/engines/oga.rb', line 19

def on_element(namespace, name, attrs = {})
  @depth += 1
  @stack.start_element(name)
  attrs.each do |attr|
    @stack.attr(*attr)
  end
end

#on_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.



27
28
29
# File 'lib/aws-sdk-core/xml/parser/engines/oga.rb', line 27

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

#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.



13
14
15
16
17
# File 'lib/aws-sdk-core/xml/parser/engines/oga.rb', line 13

def parse(xml)
  Oga.sax_parse_xml(self, xml, strict:true)
rescue LL::ParserError => error
  raise ParsingError.new(error.message, nil, nil)
end