小编Mic*_*ent的帖子

通过 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>
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 解析器吗?宁愿避免使用正则表达式......那将是一场噩梦。

python xml ant minidom xml-parsing

4
推荐指数
1
解决办法
4617
查看次数

标签 统计

ant ×1

minidom ×1

python ×1

xml ×1

xml-parsing ×1