nbxmpp.simplexml

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

# Module simplexml

source code

Simplexml module provides xmpppy library with all needed tools to handle XML nodes and XML streams. I'm personally using it in many other separate projects. It is designed to be as standalone as possible

Classes | [hide private]
| Node Node class describes syntax of separate XML Node. It have a constructor that permits node creation from set of "namespace name", attributes and payload of text strings and other nodes. It does not natively support building node from text string and uses NodeBuilder class for that purpose. After creation node can be mangled in many ways so it can be completely changed. Also node can be serialised into string in one of two modes: default (where the textual representation of node describes it exactly) and "fancy" - with whitespace added to make indentation and thus make result more readable by human.
| T Auxiliary class used to quick access to node's child nodes
| NT Auxiliary class used to quick create node's child nodes
| NodeBuilder Builds a Node class minidom from data parsed to it. This class used for two purposes:

Functions | [hide private]
XMLescape(txt) Return provided string with symbols & < > " replaced by their respective XML entities | source code
ustr(what) Converts object "what" to unicode string using it's own __str__ method if accessible or unicode method otherwise | source code
XML2Node(xml) Convert supplied textual string into XML node. Handy f.e. for reading configuration file. Raises xml.parser.expat.parsererror if provided string is not well-formed XML | source code
BadXML2Node(xml) Convert supplied textual string into XML node. Survives if xml data is cutted half way round. I.e. "<html>some text <br>some more text". Will raise xml.parser.expat.parsererror on misplaced tags though. F.e. "<b>some text <br>some more text</b>" will not work | source code

Variables | [hide private]
| log = `logging.getLogger('nbxmpp.simplexml')`
| ENCODING = ``'``utf-8``'``
| __package__ = ``'``nbxmpp``'``

Imports: xml, logging

Function Details | [hide private]

### XMLescape(txt) | source code
Return provided string with symbols & < > " replaced by their respective XML entities

### ustr(what) | source code
Converts object "what" to unicode string using it's own __str__ method if accessible or unicode method otherwise

### XML2Node(xml) | source code
Convert supplied textual string into XML node. Handy f.e. for reading configuration file. Raises xml.parser.expat.parsererror if provided string is not well-formed XML

### BadXML2Node(xml) | source code
Convert supplied textual string into XML node. Survives if xml data is cutted half way round. I.e. "<html>some text <br>some more text". Will raise xml.parser.expat.parsererror on misplaced tags though. F.e. "<b>some text <br>some more text</b>" will not work

Variables Details | [hide private]

  ### log Value:
      logging.getLogger('nbxmpp.simplexml')

  ### ENCODING Value:
      'utf-8'

  ### __package__ Value:
      'nbxmpp'