I want to be able to change an XML node value from WiX. The XML structure looks like this:
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<setting name="setting1">
<value xsi:type="xsd:boolean">false</value>
</setting>
<setting name="setting2">
<value xsi:type="xsd:string">hello</value>
</setting>
</settings>
I want to change the string value of setting2 to something else. I'm trying to use XmlConfig
and the code that is not working looks like this:
<util:XmlConfig Id='SetSetting2' File='[#defaultSettings.xml]'
Action='create' Node='value'
ElementPath="//settings/setting[\[]@name='setting2'[\]]/value"
Name='value' Value="test"
On='install' PreserveModifiedDate='yes'
VerifyPath="//settings/setting[\[]@name='setting2'[\]]/value/"/>
But this produces XML looking like this:
<setting name="setting2">
<value xsi:type="xsd:string" value="test"></value>
</setting>
How do I make it look like the following?
<setting name="setting2">
<value xsi:type="xsd:string">test</value>
</setting>
Try omitting the
Name
attribute. Like this:See also XmlConfig Element. For attribute
Name
it says: