IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
8.13.4 TreeBuilder Objects


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.

close( )
Flushes the parser buffers, and returns the toplevel documen element.

Returns:
An Element instance.

data( data)
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.

end( tag)
Closes the current element. tag is the element name.

Returns:
The closed element.

start( tag, attrs)
Opens a new element. tag is the element name. attrs is a dictionary containing element attributes.

Returns:
The opened element.

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