Class: Aws::Xml::Parser::RexmlEngine Private
- Inherits:
-
Object
- Object
- Aws::Xml::Parser::RexmlEngine
- Includes:
- REXML::StreamListener
- Defined in:
- lib/aws-sdk-core/xml/parser/rexml_engine.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
-
#initialize(stack) ⇒ RexmlEngine
constructor
private
A new instance of RexmlEngine.
- #parse(xml) ⇒ Object private
- #tag_end(name) ⇒ Object private
- #tag_start(name, attrs) ⇒ Object private
- #text(value) ⇒ Object private
Constructor Details
#initialize(stack) ⇒ RexmlEngine
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 RexmlEngine.
13 14 15 16 |
# File 'lib/aws-sdk-core/xml/parser/rexml_engine.rb', line 13 def initialize(stack) @stack = stack @depth = 0 end |
Instance Method Details
#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.
18 19 20 21 22 23 24 25 26 |
# 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.) end end |
#tag_end(name) ⇒ 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.
40 41 42 43 |
# File 'lib/aws-sdk-core/xml/parser/rexml_engine.rb', line 40 def tag_end(name) @stack.end_element @depth -= 1 end |
#tag_start(name, attrs) ⇒ 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.
28 29 30 31 32 33 34 |
# 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 |
#text(value) ⇒ 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.
36 37 38 |
# File 'lib/aws-sdk-core/xml/parser/rexml_engine.rb', line 36 def text(value) @stack.text(value) if @depth > 0 end |