我想知道一种使用 Python 对 XML 中的元素进行注释和取消注释的方法。
<target depends="create-build-dir" name="build-Folio">
<property name="project.name" value="Folio"/>
<ant antfile="build.xml" dir="Folio/FolioUI" inheritall="false" target="package"/>
<ant antfile="build.xml" dir="Folio/Folio" inheritall="false" target="package"/>
</target>
我怎样才能让它看起来像这样:
<target depends="create-build-dir" name="build-Folio">
<property name="project.name" value="Folio"/>
<ant antfile="build.xml" dir="Folio/FolioUI" inheritall="false" target="deploy"/>
<!-- <ant antfile="build.xml" dir="Folio/Folio" inheritall="false" target="deploy"/> -->
</target>
然后根据需要再次删除评论...或
我正在使用来自 xml.dom 的 minidom。我需要使用不同的 XML 解析器吗?宁愿避免使用正则表达式……那将是一场噩梦。