删除 WiX 中的所有 XML 子项 [英] Deleting all XML children in WiX
本文介绍了删除 WiX 中的所有 XML 子项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Wix 有没有办法删除特定 XML 元素的所有子元素?
我尝试了以下方法:
<util:XmlConfig Id="Perf_delete"
File="[INSTALLFOLDER]unity.config"
ElementPath='/configuration/unity/container/register[\[]@name="Perf"[\]]/constructor/param[\[]@name="machineNames"[\]]/array'
VerifyPath="*"
Action="delete"
Node="element"
On="install"/>
我在这里指定:
- ElementPath - 指向元素本身
- VerifyPath - * 指定所有子元素
但这只会删除第一个孩子.
But this deletes only the first child.
显然有一个解决方法是删除元素本身,然后重新创建它,但是所有属性和命名空间都非常繁琐.
There is obviously a workaround to delete the element itself, and then recreate it, but it's very tedious with all the attributes and namespaces.
推荐答案
您可以删除父元素,然后重新创建它,而无需添加新的嵌套子元素.仅使用一个 util:XmlConfig 声明无法从父元素中删除多个子元素.
You can delete the parent element and then create it again without adding new nested child elements. There is no way to remove multiple child elements from a parent element with just one util:XmlConfig declaration.
这篇关于删除 WiX 中的所有 XML 子项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文