Class: Aws::Xml::Parser::LibxmlEngine Private

Inherits:
Object
  • Object
show all
Includes:
LibXML::XML::SaxParser::Callbacks
Defined in:
lib/aws-sdk-core/xml/parser/engines/libxml.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) ⇒ LibxmlEngine

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



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

def initialize(stack)
  @stack = stack
end

Instance Method Details

#on_characters(chars) ⇒ 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/engines/libxml.rb', line 31

def on_characters(chars)
  @stack.text(chars)
end

#on_end_element_ns(*ignored) ⇒ 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/libxml.rb', line 27

def on_end_element_ns(*ignored)
  @stack.end_element
end

#on_error(msg) ⇒ 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
# File 'lib/aws-sdk-core/xml/parser/engines/libxml.rb', line 35

def on_error(msg)
  @stack.error(msg)
end

#on_start_element_ns(element_name, attributes, *ignored) ⇒ 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.



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

def on_start_element_ns(element_name, attributes, *ignored)
  @stack.start_element(element_name)
  attributes.each do |attr_name, attr_value|
    @stack.attr(attr_name, attr_value)
  end
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.



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

def parse(xml)
  parser = ::LibXML::XML::SaxParser.string(xml)
  parser.callbacks = self
  parser.parse
end