Add namespace in xpath in XmlFile Element (Wix Util Extension)

倾然丶 夕夏残阳落幕 提交于 2020-01-15 20:25:23

问题


The ElementPath attribute of XmlFile element in wix accepts an xpath to select the target. How can I include namespace prefixes in this xpath?


回答1:


According to this issue entry it seems to be a bug or better: a not implemented feature, as an eventually existing default namespace is not exposed by the util:XmlFile-element.
According to the first comment in this entry you can work around this issue by using util:XmlConfig which should look in the empty namespace for the needed nodes / elements.

Edit: I've found another method for using it: according to this SO question by @LarsH you can use something like the following (didn't test it myself, but as it seem to be a valid XPath 1.0 expression, it should normally work):

"*[local-name() = 'foo' and namespace-uri() = 'http://my.org/ns/2.0']"

Remember to escape the square brackets, i.e. [...] should become [\[]...[\]].



来源:https://stackoverflow.com/questions/23472654/add-namespace-in-xpath-in-xmlfile-element-wix-util-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!