class Aws::Xml::Parser::RexmlEngine
Public Class Methods
Source
# File lib/aws-sdk-core/xml/parser/rexml_engine.rb, line 13 def initialize(stack) @stack = stack @depth = 0 end
Public Instance Methods
Source
# File lib/aws-sdk-core/xml/parser/rexml_engine.rb, line 18 def parse(xml) begin mutable_xml = xml.dup # REXML only accepts mutable string source = REXML::Source.new(mutable_xml) REXML::Parsers::StreamParser.new(source, self).parse rescue REXML::ParseException => error @stack.error(error.message) end end
Source
# File lib/aws-sdk-core/xml/parser/rexml_engine.rb, line 40 def tag_end(name) @stack.end_element @depth -= 1 end
Source
# File lib/aws-sdk-core/xml/parser/rexml_engine.rb, line 28 def tag_start(name, attrs) @depth += 1 @stack.start_element(name) attrs.each do |attr| @stack.attr(*attr) end end
Source
# File lib/aws-sdk-core/xml/parser/rexml_engine.rb, line 36 def text(value) @stack.text(value) if @depth > 0 end