我只想使用python dom或elementtree删除xml文件的文本值。我的xml文件如下。
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PostBuildEvent>
<Command>sign "Loc" </Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PostBuildEvent>
<Command>COPY "SourceLoc" "DestLoc"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PostBuildEvent>
<Command>COPY "SourceLoc" "DestLoc"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
</Project>
我想要的是清空包含复制过程的命令标签。并保持所有其他命令标签没有复制过程,如下面的 xml
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PostBuildEvent>
<Command>sign "Loc" </Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PostBuildEvent>
<Command></Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PostBuildEvent>
<Command></Command>
</PostBuildEvent>
</ItemDefinitionGroup>
</Project>