Texte de XML Doc en Python

import xml.dom.minidom

document = """\
<slideshow>
<title>Demo slideshow</title>
<slide><title>Slide title</title>
<point>This is a demo</point>
<point>Of a program for processing slides</point>
</slide>

<slide><title>Another demo slide</title>
<point>It is important</point>
<point>To have more than</point>
<point>one slide</point>
</slide>
</slideshow>
"""
def getText(nodelist):
    rc = []
    for node in nodelist:
        if node.nodeType == node.TEXT_NODE:
            rc.append(node.data)
    return ''.join(rc)
dom = xml.dom.minidom.parseString(document)
title=dom.getElementsByTagName("title")[0]
slides=dom.getElementsByTagName("slide")
for slide in slides:
    s_title = slide.getElementsByTagName("title")[0]
    print( getText(title.childNodes))
Pythonist