June 2000
Intermediate to advanced
556 pages
8h 45m
English
The pyDOM package provides a number of utilities for processing DOM trees over and above what the DOM spec specifies. One of the most useful is the Walker class, which simplifies the process of walking an entire tree structure in top-down, left-to-right order.
In the example below, a class derived from Walker generates a subset of PYX from a DOM tree.
CD-ROM reference=11004.txt """ Walk a DOM Tree, generating PYX. """ # Import core DOM. from xml.dom import core # Import DOM walker utility class. from xml.dom.walker import Walker # Import DOM SAX builder. from xml.dom.sax_builder import SaxBuilder import string,sys # Import SAX. from xml.sax import saxexts,saxlib def Encode(s): """ Function to escape newlines for PYX ...
Read now
Unlock full access