无法在xml中写入更新的值

时间:2017-11-01 05:29:40

标签: python xml python-2.7 python-3.x parsing

我可以设置更新的值,但不会写回xml

 xml_doc = minidom.parse(xml_path)
    item_list = xml_doc.getElementsByTagName('JOB')
    for items in item_list:
        if str(items.attributes['JOBNAME'].value) in parsedXmlData:
            old_value = items.attributes['CMDLINE'].value
            print old_value
            items.setAttribute('CMDLINE', parsedXmlData[str(items.attributes['JOBNAME'].value)])
            print "New Value", items.attributes['CMDLINE'].value

我到底错过了什么?

0 个答案:

没有答案