The xml.dom package also includes various helper classes for common tasks such as walking over trees.
The Walker class
Introduction to the walker class