8.13.4 TreeBuilder Objects
class TreeBuilder( |
[element_factory]) |
-
Generic element structure builder. This builder converts a sequence
of start, data, and end method calls to a well-formed element structure.
You can use this class to build an element structure using a custom XML
parser, or a parser for some other XML-like format.
The element_factory is called to create new Element instances when
given.
-
Flushes the parser buffers, and returns the toplevel documen
element.
- Returns:
-
An Element instance.
-
Adds text to the current element.
data is a string. This should be either an 8-bit string
containing ASCII text, or a Unicode string.
-
Closes the current element.
tag is the element name.
- Returns:
-
The closed element.
-
Opens a new element.
tag is the element name.
attrs is a dictionary containing element attributes.
- Returns:
-
The opened element.
Release 2.5.4, documentation updated on 23rd December, 2008.
See About this document... for information on suggesting changes.