I am learning how to parse XML content with Python, and the tutorial I've followed is the Dive Into Python. In Chapter 9, most of the examples are clear for a newbie to follow. When I tried the example 9.10 (toxml works on any node), however, unexpected results occurred.
Fortunately, someone had the same problem and there is a solution: Possible error in 'dive into Python' book, help!
The key point is to use documentElement instead of firstChild.
I don't realize the reason yet. More study is necessary for me to understand the whole idea.