Class Jabber::Protocol::ParsedXMLElement
|
|
This class is constructed from XML data elements that are received from the
Jabber service.
[],
add_attribute,
add_child,
append_data,
consume_element,
count,
element_consumed?,
method_missing,
new,
size,
to_s,
[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
|
Class Jabber::Protocol::ParsedXMLElement::NilParsedXMLElement
Construct an instance for the given tag
Add the attribute to the element
<tag name="value">data</tag>
Factory to build a child element from this element with the given tag
When an xml is received from the Jabber
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.
Checks if the element is consumed
return: | [Boolean] True if the element is consumed
|
Appends data to the element
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.
Returns the count of siblings with this element's tag
return: | [Integer] The number of sibling elements
|
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
Returns the valid XML as a string
return: | [String] XML string
|