Package pyxmpp :: Module xmlextra :: Class StreamHandler

[hide private]

# Class StreamHandler

source code

Known Subclasses:
  - streambase.StreamBase

Base class for stream handler.

Instance Methods | [hide private]

__init__(self) | source code

_stream_start(self, _doc) Process stream start. | source code

_stream_end(self, _doc) Process stream end. | source code

_stanza(self, _doc, _node) Process complete stanza. | source code

stream_start(self, doc) Called when the start tag of root element is encountered in the stream. | source code

stream_end(self, doc) Called when the end tag of root element is encountered in the stream. | source code

stanza(self, _unused, node) Called when the end tag of a direct child of the root element is encountered in the stream. | source code

error(self, descr) Called when an error is encountered in the stream. | source code

Method Details | [hide private]

### stream_start(self, doc)

source code

Called when the start tag of root element is encountered in the stream.

Parameters:
  - `doc` (`libxml2.xmlDoc`) - the document being parsed.

### stream_end(self, doc)

source code

Called when the end tag of root element is encountered in the stream.

Parameters:
  - `doc` (`libxml2.xmlDoc`) - the document being parsed.

### stanza(self, _unused, node)

source code

Called when the end tag of a direct child of the root element is encountered in the stream.

Please note, that node will be removed from the document and freed after this method returns. If it is needed after that a copy must be made before the method returns.

Parameters:
  - `_unused` (`libxml2.xmlDoc`) - the document being parsed.
  - `node` (`libxml2.xmlNode`) - the (complete) element being processed

### error(self, descr)

source code

Called when an error is encountered in the stream.

Parameters:
  - `descr` (`str`) - description of the error