Package twisted :: Package web :: Module microdom

[frames | no frames]

## Module twisted.web.microdom

Micro Document Object Model: a partial DOM implementation with SUX.

This is an implementation of what we consider to be the useful subset of the DOM. The chief advantage of this library is that, not being burdened with standards compliance, it can remain very stable between versions. We can also implement utility 'pythonic' ways to access and mutate the XML tree.

Since this has not subjected to a serious trial by fire, it is not recommended to use this outside of Twisted applications. However, it seems to work just fine for the documentation generator, which parses a fairly representative sample of XML.

Microdom mainly focuses on working with HTML and XHTML.

Classes
`_Attr` | Support class for getAttributeNode.
`CDATASection` |
`CharacterData` |
`Comment` | A comment node.
`Document` |
`Element` |
`EntityReference` |
`lmx` | Easy creation of XML.
`MicroDOMParser` |
`Node` |
`Text` |

Exceptions
`MismatchedTags` |

Function Summary
| `_reverseDict(d)`
| ``_selectDict`(dct, caseInsensitive, preserveCase)` Return a copy of the dct with case sensitivity/preserving turned on as appropriate.
| `_unescapeDict(d)`
| ``escape`(text, chars)` Escape a few XML special chars with XML entities.
| `genprefix()`
| `getElementsByTagName(iNode, name)`
| `getElementsByTagNameNoCase(iNode, name)`
| ``parse`(readable, *args, **kwargs)` Parse HTML or XML readable.
| `parseString(st, *args, **kw)`
| ``parseXML`(readable)` Parse an XML readable object.
| ``parseXMLString`(st)` Parse an XML readable object.
| ``unescape`(text, chars)` Perform the exact opposite of 'escape'.

Variable Summary
`method-wrapper` | `_nextid` = `<method-wrapper object at 0x851f0ac>`
`int` | `dictsAreNotSequences` = 0
`tuple` | `HTML_ESCAPE_CHARS` = `(('&', '&amp;'), ('<', '&lt;'), ('>'...`
`tuple` | `XML_ESCAPE_CHARS` = `(('&', '&amp;'), ('<', '&lt;'), ('>',...`

Function Details

### _selectDict(dct, caseInsensitive, preserveCase)

Return a copy of the dct with case sensitivity/preserving turned on as appropriate.

### escape(text, chars=(('&', '&amp;'), ('<', '&lt;'), ('>', '&gt;'), ('"', '&qu...)

Escape a few XML special chars with XML entities.

### parse(readable, *args, **kwargs)

Parse HTML or XML readable.

### parseXML(readable)

Parse an XML readable object.

### parseXMLString(st)

Parse an XML readable object.

### unescape(text, chars=(('&', '&amp;'), ('<', '&lt;'), ('>', '&gt;'), ('"', '&qu...)

Perform the exact opposite of 'escape'.

Variable Details

### _nextid

  Type:
    `method-wrapper`
  Value:

        <method-wrapper object at 0x851f0ac>

### dictsAreNotSequences

  Type:
    `int`
  Value:

        0

### HTML_ESCAPE_CHARS

  Type:
    `tuple`
  Value:

        (('&', '&amp;'), ('<', '&lt;'), ('>', '&gt;'), ('"', '&quot;'))

### XML_ESCAPE_CHARS

  Type:
    `tuple`
  Value:

        (('&', '&amp;'),
         ('<', '&lt;'),
         ('>', '&gt;'),
         ('"', '&quot;'),
         ("'", '&apos;'))

Generated by Epydoc 2.0 on Sat May 15 20:07:45 2004 | http://epydoc.sf.net