#!/usr/bin/python -u import libxml2 doc = libxml2.parseFile("ex1.xml") p = doc.children print p.name doc.freeDoc()