PyDocs

Nav

Structured Markup Processing Tools

TreeBuilder

  • TreeBuilder(element_factory=None, *, comment_factory=None, pi_factory=None, insert_comments=False, insert_pis=False)
Generic element structure builder. This builder converts a sequence of start, data, end, comment and pi 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.
Members of TreeBuilder

c

close
Flushes the builder buffers, and returns the toplevel document element.
comment
Creates a comment with the given text.

d

data
Adds text to the current element.
doctype
Handles a doctype declaration.

e

end
Closes the current element.
end_ns
Is called after the end() callback of an element that declared a namespace prefix mapping, with the name of the prefix that went out of scope.

p

pi
Creates a process instruction with the given target name and text.

s

start
Opens a new element.
start_ns
Is called whenever the parser encounters a new namespace declaration, before the start() callback for the opening element that defines it.
0 Examples
No examples for xml.etree.ElementTree/TreeBuilder.
See Also
No see-alsos for xml.etree.ElementTree/TreeBuilder
0 Notes
No notes for TreeBuilder