In: jabber4r/protocol.rb
Parent: Object

This class is constructed from XML data elements that are received from the Jabber service.



 [R]  :element_children

A hash of ParsedXMLElement children

 [R]  :element_data

The data <tag>data</tag> for a tag

 [R]  :element_parent

The parent ParsedXMLElement

 [R]  :element_tag

The <tag> as String

Classes and Modules

Class Jabber::Protocol::ParsedXMLElement::NilParsedXMLElement

Public Class methods
new(tag, parent=nil) src

Construct an instance for the given tag

tag:[String] The tag
parent:[Jabber::Protocol::ParsedXMLElement = nil] The parent element
Public Instance methods
add_attribute(name, value) src

Add the attribute to the element

  <tag name="value">data</tag>

name:[String] The attribute name
value:[String] The attribute value
return:[Jabber::Protocol::ParsedXMLElement] self for chaining #
add_child(tag) src

Factory to build a child element from this element with the given tag

tag:[String] The tag name
return:[Jabber::Protocol::ParsedXMLElement] The newly created child element
consume_element() src

service and a ParsedXMLElement is created, it is propogated to all filters and listeners. Any one of those can consume the element to prevent its propogation to other filters or listeners. This method marks the element as consumed.

element_consumed?() src

Checks if the element is consumed

return:[Boolean] True if the element is consumed
append_data(data) src

Appends data to the element

data:[String] The data to append
return:[Jabber::Protocol::ParsedXMLElement] self for chaining
[](number) src

Calls the parent's element_children (hash) index off of this elements tag and gets the supplied index. In this sense it gets its sibling based on offset.

number:[Integer] The number of the sibling to get
return:[Jabber::Protocol::ParsedXMLElement] The sibling element
count() src

Returns the count of siblings with this element's tag

return:[Integer] The number of sibling elements
size() src

see _count

method_missing(methId, *args) src

Overrides to allow for directly accessing child elements and attributes. If prefaced by attr_ it looks for an attribute that matches or checks for a child with a tag that matches the method name. If no match occurs, it returns a NilParsedXMLElement (singleton) instance.

Example:<alpha number="1"><beta number="2">Beta Data</beta></alpha>

 element.element_tag #=> alpha

 element.attr_number #=> 1

 element.beta.element_data #=> Beta Data

to_s() src

Returns the valid XML as a string

return:[String] XML string