nbxmpp.simplexml.NodeBuilder

Package nbxmpp :: Module simplexml :: Class NodeBuilder |
[hide private]
[frames] | no frames]

# Class NodeBuilder

source code

Builds a Node class minidom from data parsed to it. This class used for two purposes:

> 1. Creation an XML Node from a textual representation. F.e. reading a config file. See an XML2Node method.
> 2. Handling an incoming XML stream. This is done by mangling the __dispatch_depth parameter and redefining the dispatch method.

You do not need to use this class directly if you do not designing your own XML handler

Instance Methods | [hide private]
__init__(self, data=None, initial_node=None) Take two optional parameters: "data" and "initial_node" | source code
check_data_buffer(self) | source code
destroy(self) Method used to allow class instance to be garbage-collected | source code
starttag(self, tag, attrs) XML Parser callback. Used internally | source code
endtag(self, tag) XML Parser callback. Used internally | source code
handle_cdata(self, data) | source code
handle_namespace_start(self, prefix, uri) XML Parser callback. Used internally | source code
getDom(self) Return just built Node | source code
dispatch(self, stanza) Get called when the NodeBuilder reaches some level of depth on it's way up with the built node as argument. Can be redefined to convert incoming XML stanzas to program events | source code
stream_header_received(self, ns, tag, attrs) Method called when stream just opened | source code
stream_footer_received(self) Method called when stream just closed | source code
has_received_endtag(self, level=0) Return True if at least one end tag was seen (at level) | source code
_inc_depth(self) | source code
_dec_depth(self) | source code

Method Details | [hide private]

### __init__(self, data=None, initial_node=None) (Constructor) | source code
Take two optional parameters: "data" and "initial_node" By default class initialised with empty Node class instance. Though, if "initial_node" is provided it used as "starting point". You can think about it as of "node upgrade". "data" (if provided) feeded to parser immidiatedly after instance init.

### check_data_buffer(self) | source code

### destroy(self) | source code
Method used to allow class instance to be garbage-collected

### starttag(self, tag, attrs) | source code
XML Parser callback. Used internally

### endtag(self, tag) | source code
XML Parser callback. Used internally

### handle_cdata(self, data) | source code

### handle_namespace_start(self, prefix, uri) | source code
XML Parser callback. Used internally

### getDom(self) | source code
Return just built Node

### dispatch(self, stanza) | source code
Get called when the NodeBuilder reaches some level of depth on it's way up with the built node as argument. Can be redefined to convert incoming XML stanzas to program events

### stream_header_received(self, ns, tag, attrs) | source code
Method called when stream just opened

### stream_footer_received(self) | source code
Method called when stream just closed

### has_received_endtag(self, level=0) | source code
Return True if at least one end tag was seen (at level)

### _inc_depth(self) | source code

### _dec_depth(self) | source code