WIX XmlConfig VerifyPath 转义 [英] WIX XmlConfig VerifyPath escaping
问题描述
我正在使用 WIX 在文件中添加 XML 元素.当我的 util:XmlConfig 元素有一个像这样的 VerifyPath 属性时:
I am using WIX to add an XML element in a file. When my util:XmlConfig element had a VerifyPath attribute like this:
VerifyPath="/configuration/App/add[@key='ApiURL']"
什么都没发生.现在我已将其更改为如下所示(基于我在代码库中的其他地方找到的一些其他代码):
nothing happened. Now I've changed it to look like this (based on some other code I found elsewhere in our codebase):
VerifyPath="/configuration/App/add[\[]@key='ApiURL'[\]]"
并且它正确地添加了元素.这是什么转义,为什么有必要?
And it is correctly adding the element. What is this escaping and why is it necessary?
推荐答案
我试图独立地找出与您相同问题的答案,但我找到了回答您问题的线索 这里.这个 StackOverflow 答案让我找到了这个 文档 关于 Windows Installer 中的格式化类型.
I was trying to figure out the answer to the same question as you independantly and I found the clue to answer your question here. This StackOverflow answer led me to this document about Formatted types in Windows Installer.
我已经复制了下面的相关文本,但简而言之 "[\[]"
是您获得文字 "["
字符的方式.
I have copied the relevant text below, but in short "[\[]"
is how you get a literal "["
character.
如果找到 [\x] 形式的子字符串,则将其替换为字符 x ,其中 x 是一个字符,无需任何进一步处理.只保留反斜杠后的第一个字符;其他一切都被删除了.例如,要包含文字左括号 ([),请使用 [\[].文本 [\[]Bracket Text[\]] 解析为 [Bracket Text].
If a substring of the form [\x] is found, it is replaced by the character x , where x is one character, without any further processing. Only the first character after the backslash is kept; everything else is removed. For example, to include a literal left bracket ([), use [\[]. The text [\[]Bracket Text[\]] resolves to [Bracket Text].
这篇关于WIX XmlConfig VerifyPath 转义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!