Movatterモバイル変換


[0]ホーム

URL:


Up one LevelPython Library ReferenceContentsModule IndexIndex


8.13.4 TreeBuilder Objects

class TreeBuilder([element_factory])
Generic element structure builder. This builder converts a sequenceof 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 XMLparser, or a parser for some other XML-like format.Theelement_factory is called to create new Element instances whengiven.

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

Returns:
An Element instance.

data(data)
Adds text to the current element.data is a string. This should be either an 8-bit stringcontaining 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.


Up one LevelPython Library ReferenceContentsModule IndexIndex

Release 2.5.2, documentation updated on 21st February, 2008.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2025 Movatter.jp