我想知道一种使用 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>
Run Code Online (Sandbox Code Playgroud)
我怎样才能让它看起来像这样:
<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>
Run Code Online (Sandbox Code Playgroud)
然后根据需要再次删除评论......或
我正在使用 xml.dom 中的 minidom。我需要使用不同的 XML 解析器吗?宁愿避免使用正则表达式......那将是一场噩梦。