我想知道如何使用Python评论和取消注释XML中的元素。通过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>
,然后再删除评论需要... 或
我使用minidom命名从xml.dom的。我需要使用不同的XML解析器吗?宁愿避免使用正则表达式...这将是一场噩梦。
应该怎样一个指定要c的内容omment(行号,x + y位置)? – 2012-01-06 21:31:37
希望通过属性,如果其可能 – 2012-01-06 21:44:49