Module: XMLRPC::XMLParser::StreamParserMixin (Ruby 2.2.2)
Description: Module : XMLRPC::XMLParser::StreamParserMixin - Ruby 2.2.2

- Home
- Core 2.2.2
- Std-lib 2.2.2
- Downloads

Support for the Ruby 2.2 series has ended. See here for reference.

### Home Classes Methods

### In Files

- xmlrpc/parser.rb

### Methods

- ::new
- #character
- #endElement
- #startElement

### Class/Module Index

Quicksearch

- NQXML
- NQXML::Node
- XMLRPC
- XMLRPC::Base64
- XMLRPC::BasicServer
- XMLRPC::CGIServer
- XMLRPC::Client
- XMLRPC::Client::Proxy
- XMLRPC::Config
- XMLRPC::Convert
- XMLRPC::Create
- XMLRPC::DateTime
- XMLRPC::FaultException
- XMLRPC::Marshal
- XMLRPC::Marshallable
- XMLRPC::ModRubyServer
- XMLRPC::ParseContentType
- XMLRPC::ParserWriterChooseMixin
- XMLRPC::Server
- XMLRPC::Service
- XMLRPC::Service::BasicInterface
- XMLRPC::Service::Interface
- XMLRPC::Service::PublicInstanceMethodsInterface
- XMLRPC::WEBrickServlet
- XMLRPC::XMLParser
- XMLRPC::XMLParser::AbstractStreamParser
- XMLRPC::XMLParser::AbstractTreeParser
- XMLRPC::XMLParser::LibXMLStreamParser
- XMLRPC::XMLParser::LibXMLStreamParser::LibXMLStreamListener
- XMLRPC::XMLParser::NQXMLParser
- XMLRPC::XMLParser::NQXMLStreamParser
- XMLRPC::XMLParser::NQXMLStreamParser::XMLRPCParser
- XMLRPC::XMLParser::NQXMLTreeParser
- XMLRPC::XMLParser::REXMLStreamParser
- XMLRPC::XMLParser::REXMLStreamParser::StreamListener
- XMLRPC::XMLParser::StreamParserMixin
- XMLRPC::XMLParser::XMLParser
- XMLRPC::XMLParser::XMLScanStreamParser
- XMLRPC::XMLParser::XMLScanStreamParser::XMLScanParser
- XMLRPC::XMLParser::XMLStreamParser
- XMLRPC::XMLParser::XMLTreeParser
- XMLRPC::XMLWriter
- XMLRPC::XMLWriter::Abstract
- XMLRPC::XMLWriter::Simple
- XMLRPC::XMLWriter::XMLParser

No matching classes.

# XMLRPC::XMLParser::StreamParserMixin

### Attributes

fault[R]
method_name[R]
params[R]

### Public Class Methods

new(*a) click to toggle source

                   # File xmlrpc/parser.rb, line 512
    def initialize(*a)
      super(*a)
      @params = []
      @values = []
      @val_stack = []

      @names = []
      @name = []

      @structs = []
      @struct = {}

      @method_name = nil
      @fault = nil

      @data = nil
    end

### Public Instance Methods

character(data) click to toggle source

                   # File xmlrpc/parser.rb, line 595
    def character(data)
      if @data
        @data << data
      else
        @data = data
      end
    end

endElement(name) click to toggle source

                   # File xmlrpc/parser.rb, line 550
    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

startElement(name, attrs=[]) click to toggle source

                   # File xmlrpc/parser.rb, line 530
    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