Package pyxmpp :: Module objects :: Class StanzaPayloadWrapperObject
[hide private]

Class StanzaPayloadWrapperObject

source code

object --+
         |
        StanzaPayloadWrapperObject
Known Subclasses:

Base class for objects that may be used as XMPP stanza payload and maintain an internal XML representation of self.

Provides as_xml method. Objects of derived classes must have the xmlnode attribute.

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

Instance Methods [hide private]
libxml2.xmlNode or libxml2.xmlDoc
as_xml(self, parent=None, doc=None)
Get the XML representation of self.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
: libxml2.xmlNode xmlnode
: XML node of the object.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 

Get the XML representation of self.

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

Parameters:
  • parent (: libxml2.xmlNode) - : the parent for the XML element.
  • doc (: libxml2.xmlDoc) - : 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.
Returns: libxml2.xmlNode or libxml2.xmlDoc
the new XML element (copy of self.xmlnode) or document created (containg the copy as the root element).