twisted.words.xish.xmlstream.XmlStream(protocol.Protocol, utility.EventDispatcher)class documentation
twisted.words.xish.xmlstreamView Source (View In Hierarchy)
Known subclasses: twisted.words.protocols.jabber.xmlstream.XmlStream
Generic Streaming XML protocol handler.
This protocol handler will parse incoming data as XML and dispatch
events accordingly. Incoming stanzas can be handled by registering
observers using XPath-like expressions that are matched against each
|Method||connectionMade||Called when a connection is made.|
|Method||dataReceived||Called whenever data is received.|
|Method||connectionLost||Called when the connection is shut down.|
|Method||onDocumentStart||Called whenever the start tag of a root element has been received.|
|Method||onElement||Called whenever a direct child element of the root element has been received.|
|Method||onDocumentEnd||Called whenever the end tag of the root element has been received.|
|Method||setDispatchFn||Set another function to handle elements.|
|Method||resetDispatchFn||Set the default function (
|Method||send||Send data over the stream.|
|Method||_initializeStream||Sets up XML Parser.|
Inherited from Protocol:
|Method||logPrefix||Return a prefix matching the class name, to identify log messages related to this protocol instance.|
|Method||makeConnection||Make a connection to a transport and a server.|
Inherited from EventDispatcher:
|Method||addOnetimeObserver||Register a one-time observer for an event.|
|Method||addObserver||Register an observer for an event.|
|Method||removeObserver||Remove callable as observer for an event.|
|Method||dispatch||Dispatch an event.|
Sets up XML Parser.
Called when a connection is made.
Sets up the XML parser and dispatches the
event indicating the connection has been established.
Called whenever data is received.
Passes the data to the XML parser. This can result in calls to the DOM
handlers. If a parse error occurs, the
event is called to allow for cleanup actions, followed by dropping the
Called whenever the start tag of a root element has been received.
Called whenever a direct child element of the root element has been received.
Dispatches the received element.
Called whenever the end tag of the root element has been received.
Closes the connection. This causes
Set another function to handle elements.
Set the default function (
onElement) to handle
Send data over the stream.
Sends the given
obj over the connection.
may be instances of
str. The first two will be properly
serialized and/or encoded.
str objects must be in UTF-8
Note: because it is easy to make mistakes in maintaining a properly
str object, it is advised to use
objects everywhere when dealing with XML Streams.
|Parameters||obj||Object to be sent over the stream. (type: |