Package pyxmpp :: Module objects :: Class StanzaPayloadObject
[show private | hide private]
[frames | no frames]

Type StanzaPayloadObject

object --+
         |
        StanzaPayloadObject

Known Subclasses:
Delay, Field, Form, Item, Option, Register, Roster, RosterItem, VCard

Base class for objects that may be used as XMPP stanza payload and don't keep
internal XML representation, only parsed values.

Provides `as_xml` method. Derived classes must override `xml_element_name` and
`xml_element_namespace` class attributes and the `complete_xml_element` method.

Please note that not all classes derived from `StanzaPayloadObject` should be
used directly as stanza payload. Some of them are parts of higher level objects.

:Cvariables:
    - `xml_element_name`: name for the XML element provided by the class.
    - `xml_element_namespace`: namespace URI for the XML element provided
      by the class.
:Types:
    - `xml_element_name`: `unicode`
    - `xml_element_namespace`: `unicode`

Method Summary
  as_xml(self, parent, doc)
Get the XML representation of `self`.
  complete_xml_element(self, xmlnode, doc)
Complete the XML node with `self` content.
    Inherited from object
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
NoneType xml_element_name = None                                                                  
NoneType xml_element_namespace = None                                                                  

Method Details

as_xml(self, parent=None, doc=None)

Get the XML representation of `self`.

New document will be created if no `parent` and no `doc` is given.

:Parameters:
    - `parent`: the parent for the XML element.
    - `doc`: the document where the element should be created. If not
      given and `parent` is provided then autodetection is attempted.
      If that fails, then `common_doc` is used.
:Types:
    - `parent`: `libxml2.xmlNode`
    - `doc`: `libxml2.xmlDoc`
:return: the new XML element or document created.
:returntype: `libxml2.xmlNode` or `libxml2.xmlDoc`

complete_xml_element(self, xmlnode, doc)

Complete the XML node with `self` content.

Should be overriden in classes derived from `StanzaPayloadObject`.

:Parameters:
    - `xmlnode`: XML node with the element being built. It has already
      right name and namespace, but no attributes or content.
    - `doc`: document to which the element belongs.
:Types:
    - `xmlnode`: `libxml2.xmlNode`
    - `doc`: `libxml2.xmlDoc`

Class Variable Details

xml_element_name

Type:
NoneType
Value:
None                                                                  

xml_element_namespace

Type:
NoneType
Value:
None                                                                  

Generated by Epydoc 2.1 on Wed May 31 22:37:01 2006 http://epydoc.sf.net