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

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



12
13
14
15
# File 'lib/aws-sdk-core/xml/parser/oga_engine.rb', line 12

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.



35
36
37
38
# File 'lib/aws-sdk-core/xml/parser/oga_engine.rb', line 35

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.



23
24
25
26
27
28
29
# File 'lib/aws-sdk-core/xml/parser/oga_engine.rb', line 23

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.



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

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.



17
18
19
20
21
# File 'lib/aws-sdk-core/xml/parser/oga_engine.rb', line 17

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