2
<student id="1" student:name="robert">
<sectionA>
<class name="first"/>
</sectionA>
</student>
<student id="2" student:name="lucky">
<sectionB>
<class name="first"/>
</sectionB>
</student>
<student id="2" student:name="Dave">
<sectionA>
<class name="third"/>
</sectionA>
</student>
from xml.dom import minidom
dom1 = minidom.parse("file.xml")
student = dom1.getElementsByTagName("student")
for b in student:
sectionA = dom1.getElementsByTagName("sectionA")
for a in sectionA:
name = b.getAttribute("student:name")
print name
これは私に次のように出力できます:この行で ロバート デイブPythonのminidom XMLパーサー3
おかげ それは:)働いていました – wrdw