Sha256: d1811711992717612dbf8b0798f10fd185b1ee36083b09158776d97f6898a457

Contents?: true

Size: 761 Bytes

Versions: 1159

Compression:

Stored size: 761 Bytes

Contents

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

1,159 entries across 1,159 versions & 2 rubygems

Version Path
aws-sdk-core-2.11.632 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.631 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.630 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.629 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.628 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.627 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.626 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.625 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.624 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.623 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.622 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.621 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.620 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.619 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.618 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.617 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.616 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.615 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.614 lib/aws-sdk-core/xml/parser/engines/oga.rb
aws-sdk-core-2.11.613 lib/aws-sdk-core/xml/parser/engines/oga.rb