### Home Classes Methods

### In Files

- lib/dbus/introspect.rb

### Parent

Object

### Methods

- ::new
- #parse
- #parse_subnodes

### Files

- README

### Class/Module Index

Quicksearch

- DBus
- DBus::ASessionBus
- DBus::ASystemBus
- DBus::AuthenticationFailed
- DBus::Authenticator
- DBus::Client
- DBus::Connection
- DBus::Connection::NameRequestError
- DBus::DBusCookieSHA1
- DBus::Error
- DBus::ErrorMessage
- DBus::External
- DBus::FormalParameter
- DBus::IncompleteBufferException
- DBus::Interface
- DBus::InterfaceElement
- DBus::IntrospectXMLParser
- DBus::InvalidClassDefinition
- DBus::InvalidDestinationName
- DBus::InvalidIntrospectionData
- DBus::InvalidMethodName
- DBus::InvalidPacketException
- DBus::InvalidParameters
- DBus::Main
- DBus::MatchRule
- DBus::MatchRuleException
- DBus::Message
- DBus::Method
- DBus::MethodNotImplemented
- DBus::MethodReturnMessage
- DBus::Node
- DBus::Object
- DBus::Object::UndefinedInterface
- DBus::PacketMarshaller
- DBus::PacketUnmarshaller
- DBus::ProxyObject
- DBus::ProxyObjectFactory
- DBus::ProxyObjectInterface
- DBus::RemoteBus
- DBus::Service
- DBus::SessionBus
- DBus::Signal
- DBus::SystemBus
- DBus::Type
- DBus::Type::Parser
- DBus::Type::SignatureException
- DBus::Type::Type
- DBus::TypeException
- DBus::UnknownSignal
- Integer

No matching classes.

# DBus::IntrospectXMLParser

# D-Bus introspect XML parser class

This class parses introspection XML of an object and constructs a tree of Node, Interface, Method, Signal instances.

### Public Class Methods

new(xml) click to toggle source

Creates a new parser for XML data in string xml.

    # File lib/dbus/introspect.rb, line 228
    def initialize(xml)
      @xml = xml
    end

### Public Instance Methods

parse() click to toggle source

return a pair: [list of Interfaces, list of direct subnode names]

    # File lib/dbus/introspect.rb, line 243
    def parse
      interfaces = Array.new
      subnodes = Array.new
      t = Time.now
      d = REXML::Document.new(@xml)
      d.elements.each("node/node") do |e|
        subnodes << e.attributes["name"]
      end
      d.elements.each("node/interface") do |e|
        i = Interface.new(e.attributes["name"])
        e.elements.each("method") do |me|
          m = Method.new(me.attributes["name"])
          parse_methsig(me, m)
          i << m
        end
        e.elements.each("signal") do |se|
          s = Signal.new(se.attributes["name"])
          parse_methsig(se, s)
          i << s
        end
        interfaces << i
      end
      d = Time.now - t
      if d > 2
        puts "Some XML took more that two secs to parse. Optimize me!" if $DEBUG
      end
      [interfaces, subnodes]
    end

parse_subnodes() click to toggle source

return the names of direct subnodes

    # File lib/dbus/introspect.rb, line 233
    def parse_subnodes
      subnodes = Array.new
      d = REXML::Document.new(@xml)
      d.elements.each("node/node") do |e|
        subnodes << e.attributes["name"]
      end
      subnodes
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.