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.


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

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.


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

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.


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

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.


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

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.


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

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