123456789_123456789_123456789_123456789_123456789_

Module: XMLRPC::XMLParser::StreamParserMixin

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/xmlrpc/parser.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#fault (readonly)

[ GitHub ]

  
# File 'lib/xmlrpc/parser.rb', line 511

attr_reader :fault

#method_name (readonly)

[ GitHub ]

  
# File 'lib/xmlrpc/parser.rb', line 510

attr_reader :method_name

#params (readonly)

[ GitHub ]

  
# File 'lib/xmlrpc/parser.rb', line 509

attr_reader :params

Instance Method Details

#character(data) Also known as: #text, #cdata, #on_characters, #on_cdata_block

[ GitHub ]

  
# File 'lib/xmlrpc/parser.rb', line 596

def character(data)
  if @data
    @data << data
  else
    @data = data
  end
end

#endElement(name) Also known as: #tag_end, #on_etag

[ GitHub ]

  
# File 'lib/xmlrpc/parser.rb', line 551

def endElement(name)
  @data ||= ""
  case name
  when "string"
    @value = @data
  when "i4", "i8", "int"
    @value = Convert.int(@data)
  when "boolean"
    @value = Convert.boolean(@data)
  when "double"
    @value = Convert.double(@data)
  when "dateTime.iso8601"
    @value = Convert.dateTime(@data)
  when "base64"
    @value = Convert.base64(@data)
  when "value"
    @value = @data if @value.nil?
    @values << (@value == :nil ? nil : @value)
  when "array"
    @value = @values
    @values = @val_stack.pop
  when "struct"
    @value = Convert.struct(@struct)

    @name = @names.pop
    @struct = @structs.pop
  when "name"
    @name[0] = @data
  when "member"
    @struct[@name[0]] = @values.pop

  when "param"
    @params << @values[0]
    @values = []

  when "fault"
    @fault = Convert.fault(@values[0])

  when "methodName"
    @method_name = @data
  end

  @data = nil
end

#initialize(*a)

[ GitHub ]

  
# File 'lib/xmlrpc/parser.rb', line 513

def initialize(*a)
  super(*a)
  @params = []
  @values = []
  @val_stack = []

  @names = []
  @name = []

  @structs = []
  @struct = {}

  @method_name = nil
  @fault = nil

  @data = nil
end

#startElement(name, attrs = []) Also known as: #tag_start, #on_stag

[ GitHub ]

  
# File 'lib/xmlrpc/parser.rb', line 531

def startElement(name, attrs=[])
  @data = nil
  case name
  when "value"
    @value = nil
  when "nil"
    raise "wrong/unknown XML-RPC type 'nil'" unless Config::ENABLE_NIL_PARSER
    @value = :nil
  when "array"
    @val_stack << @values
    @values = []
  when "struct"
    @names << @name
    @name = []

    @structs << @struct
    @struct = {}
  end
end