【发布时间】:2015-10-27 03:13:29
【问题描述】:
我有这个 xml:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:request xmlns:m="http://www.datapower.com/schemas/management" domain="XXXXX">
<m:do-action>
<FlushDocumentCache>
<XMLManager class="XMLManager">default</XMLManager>
</FlushDocumentCache>
<FlushStylesheetCache>
<XMLManager class="XMLManager">default</XMLManager>
</FlushStylesheetCache>
</m:do-action>
</m:request>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
我只想更改域属性的值 XXXXX。
我做了这样的事情:
import xml.etree.ElementTree as etree
tree = etree.parse('input.xml')
# HOW TO FIND THE VALUE XXXXX AND CHANGE IT WITH A NEW VALUE ???
tree.write('output.xml')
谢谢。
【问题讨论】: