Sha256: f8d5db510bd096ce18f38ae40140d0440570961055466bb0bad3e3eea671cb0b

Contents?: true

Size: 792 Bytes

Versions: 113

Compression:

Stored size: 792 Bytes

Contents

# frozen_string_literal: true

require 'oga'

module Aws
  module Xml
    class Parser
      class OgaEngine

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

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

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

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

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

      end
    end
  end
end

Version data entries

113 entries across 113 versions & 1 rubygems

Version Path
aws-sdk-core-3.154.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.153.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.152.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.151.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.150.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.149.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.148.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.147.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.146.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.145.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.144.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.143.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.142.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.141.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.140.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.139.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.138.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.137.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.136.0 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-3.135.0 lib/aws-sdk-core/xml/parser/engines/oga.rb