Victor Mukherjee
Victor Mukherjee

Reputation: 11045

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

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

Upvotes: 1

Views: 1282

Answers (1)

taffit
taffit

Reputation: 2099

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 [\[]...[\]].

Upvotes: 1

Related Questions