The reader interface


import libxml2

reader = libxml2.newTextReaderFilename("ex.xml")
ret = reader.Read()
while ret == 1:
    print reader.Name()
    ret = reader.Read()