Sha256: 616b6476fe1968ece4436885ef76a35a1fa68bc0f622be2ebb807f0786f63974

Contents?: true

Size: 895 Bytes

Versions: 1164

Compression:

Stored size: 895 Bytes

Contents

require 'rexml/document'
require 'rexml/streamlistener'

module Aws
  module Xml
    class Parser
      class RexmlEngine

        include REXML::StreamListener

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

        def parse(xml)
          begin
            source = REXML::Source.new(xml)
            REXML::Parsers::StreamParser.new(source, self).parse
          rescue REXML::ParseException => error
            @stack.error(error.message)
          end
        end

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

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

        def tag_end(name)
          @stack.end_element
          @depth -= 1
        end

      end
    end
  end
end

Version data entries

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

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