问题
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