Python处理XML文件

用代码记录下:

import xml.dom.minidom

try:
    f = open(filename)
    dom = xml.dom.minidom.parseString(f.read())
finally:
    f.close()

if dom != None:
    root = dom.documentElement
    for element in root.getElementsByTagName("bean"):
          for prop in element.getElementsByTagName("property"):
                 if prop.getAttribute("name") == "sequenceDao":
                        print "find"

 

你可能感兴趣的:(python)