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.
---
Ref:
- xml.dom — The Document Object Model API
- Python and XML: An Introduction