【发布时间】:2012-01-06 20:25:25
【问题描述】:
我想知道一种使用 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>
然后根据需要再次移除 cmets... 或
我正在使用来自 xml.dom 的 minidom。我需要使用不同的 XML 解析器吗?宁愿避免使用正则表达式...那将是一场噩梦。
【问题讨论】:
-
如何指定要评论的内容(行号,x+y 位置)?
-
如果可能的话,希望通过属性
标签: python xml ant xml-parsing minidom