8.13.4 TreeBuilder Objects

Python 2.5

8.13.4 TreeBuilder Objects

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.

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.

The closed element.

Opens a new element. tag is the element name. attrs is a dictionary containing element attributes.

The opened element.

See About this document... for information on suggesting changes.