La respuesta anterior es correcta, a saber:
name[0].firstChild.nodeValue
Sin embargo, para mí, al igual que los demás, mi valor estaba más abajo en el árbol:
name[0].firstChild.firstChild.nodeValue
Para ello he utilizado el siguiente:
def scandown(elements, indent):
for el in elements:
print(" " * indent + "nodeName: " + str(el.nodeName))
print(" " * indent + "nodeValue: " + str(el.nodeValue))
print(" " * indent + "childNodes: " + str(el.childNodes))
scandown(el.childNodes, indent + 1)
scandown(doc.getElementsByTagName('text'), 0)
La ejecución de este para mi sencilla Imagen SVG creado con Inkscape esto me dio:
nodeName: text
nodeValue: None
childNodes: [<DOM Element: tspan at 0x10392c6d0>]
nodeName: tspan
nodeValue: None
childNodes: [<DOM Text node "'MY STRING'">]
nodeName: #text
nodeValue: MY STRING
childNodes:()
nodeName: text
nodeValue: None
childNodes: [<DOM Element: tspan at 0x10392c800>]
nodeName: tspan
nodeValue: None
childNodes: [<DOM Text node "'MY WORDS'">]
nodeName: #text
nodeValue: MY WORDS
childNodes:()
Solía xml.dom.minidom, los diversos campos son explained on this page, MiniDom Python.
Está empezando a parecer que la respuesta a la mayoría de las preguntas "minidom" es "use ElementTree". –