Class: RForce::SoapResponseExpat

Inherits:
Object
  • Object
show all
Includes:
SoapPullable
Defined in:
lib/rforce/soap_response_expat.rb

Constant Summary

Constants included from SoapPullable

RForce::SoapPullable::SOAP_ENVELOPE

Instance Method Summary collapse

Methods included from SoapPullable

#local, #tag_end, #tag_start, #text

Constructor Details

#initialize(content) ⇒ SoapResponseExpat

Returns a new instance of SoapResponseExpat.



8
9
10
# File 'lib/rforce/soap_response_expat.rb', line 8

def initialize(content)
  @content = content
end

Instance Method Details

#parseObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rforce/soap_response_expat.rb', line 12

def parse
  @current_value = nil
  @stack = []
  @parsed = OpenHash.new({})
  @done = false
  @namespaces = []

  XML::Parser.new.parse(@content) do |type, name, data|
    case type
    when XML::Parser::START_ELEM then
      tag_start name, data
    when XML::Parser::CDATA then
      text data
    when XML::Parser::END_ELEM then
      tag_end name
    end

    break if @done
  end

  @parsed
end