June 2000
Intermediate to advanced
556 pages
8h 45m
English
The Python DOM implementation provides a very useful class known as Builder. This class, an implementation of SAX DocumentHandler, uses SAX events to build a DOM tree structure. With Builder, it is straightforward to build an XML or HTML tree structure from scratch. As new nodes are added to the tree structure, Builder automatically keeps track of the current position, leading to easy-to-understand tree building code.
CD-ROM reference=11016.txt
C>type dom9.py """ Build an XML tree programmatically by using the DOM Builder class. """ from xml.dom.builder import Builder b = Builder() b.startElement("names") b.startElement("name",{"x":"y"}) b.text ("Mr. Sean Mc Grath") b.endElement("name") b.startElement("name") ...Read now
Unlock full access