Module: XMLRPC::XMLParser::StreamParserMixin

Included in:
LibXMLStreamParser::LibXMLStreamListener, REXMLStreamParser::StreamListener
Defined in:
lib/xmlrpc/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#faultObject (readonly)

Returns the value of attribute fault.



476
477
478
# File 'lib/xmlrpc/parser.rb', line 476

def fault
  @fault
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



475
476
477
# File 'lib/xmlrpc/parser.rb', line 475

def method_name
  @method_name
end

#paramsObject (readonly)

Returns the value of attribute params.



474
475
476
# File 'lib/xmlrpc/parser.rb', line 474

def params
  @params
end

Instance Method Details

#character(data) ⇒ Object



561
562
563
564
565
566
567
# File 'lib/xmlrpc/parser.rb', line 561

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

#endElement(name) ⇒ Object



516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
# File 'lib/xmlrpc/parser.rb', line 516

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) ⇒ Object



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/xmlrpc/parser.rb', line 478

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

  @names = []
  @name = []

  @structs = []
  @struct = {}

  @method_name = nil
  @fault = nil

  @data = nil
end

#startElement(name, attrs = []) ⇒ Object



496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/xmlrpc/parser.rb', line 496

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