I don’t have a definite solution, Doug, but I have a
suggestion. Have you tried just creating your <add> elements, without
specifying the <appSettings> element, in a machine.config that doesn’t
contain the <appSettings>? Maybe the XmlFile element is smart enough to
create the path if your XPath doesn’t exist. From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Douglas
Watts Does anyone know how to check for the existence of a particular
element in an XML file? I need to add <appSettings> to the machine.config
file but if I assume that the <appSettings> node does not exist then I
end up with two. The only thing I see in the WiX schema is XmlFile which
creates or updates elements. I need to query. __________ Doug Watts From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Douglas
Watts OK, either my questions are getting easier or I’m starting to get
the hang of this. I figured out that I need to escape the brackets and
now it works fine. My follow-up question is how do I check an XML file to see if an
element already exists? If the appSettings element is already there this I don’t need to
create it. However, the XmlFile Wix element is used from creating or
updating elements…not for querying them. __________ Doug Watts From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Douglas
Watts I
am trying to use the XmlFile element to modify the MACHINE.CONFIG file. I
need to add application settings for my app. I need to add settings such
that the config file ends up as follows: <appSettings>
<add key="MyKey1" value="key 1 value" />
<add key="MyKey2" value="key 2 value" />
</appSettings> First
I create an “add” element. Next, I want to set the element’s attributes
as shown above. However, when I try to set the second “add” element I end
up changing the first and adding an empty second “add” element. I tried
specifying the first element (ElementPath='//configuration/appSettings/add[1]') with no luck; I
tried the last element (ElementPath='//configuration/appSettings/add[last()]') with no luck.
I
have tried the following: <Component Id="MachineConfigComponent"
Guid="00000000-0000-0000-0000-000000000000" > <XmlFile Id='XmlSettings1'
File='[FRAMEWORKINSTALLPATH]v1.1.4322\CONFIG\Machine.Config'
Action='' Name='appSettings' ElementPath='//configuration'
Sequence='1' /> <XmlFile Id='XmlSettings2'
File='[FRAMEWORKINSTALLPATH]v1.1.4322\CONFIG\Machine.Config'
Action='' Name='add' ElementPath='//configuration/appSettings'
Sequence='2' /> <XmlFile Id='XmlSettings3'
File='[FRAMEWORKINSTALLPATH]v1.1.4322\CONFIG\Machine.Config'
Action='' Name='key' Value='MyKey1'
ElementPath='//configuration/appSettings/add'
Sequence='3' /> <XmlFile Id='XmlSettings4'
File='[FRAMEWORKINSTALLPATH]v1.1.4322\CONFIG\Machine.Config'
Action='' Name='value' Value='key 1 value'
ElementPath='//configuration/appSettings/add'
Sequence='4' /> <XmlFile Id='XmlSettings5'
File='[FRAMEWORKINSTALLPATH]v1.1.4322\CONFIG\Machine.Config'
Action='' Name='add' ElementPath='//configuration/appSettings'
Sequence='5' /> <XmlFile Id='XmlSettings6'
File='[FRAMEWORKINSTALLPATH]v1.1.4322\CONFIG\Machine.Config'
Action='' Name='key' Value='MyKey2'
ElementPath='//configuration/appSettings/add[1]'
Sequence='6' /> <XmlFile Id='XmlSettings7'
File='[FRAMEWORKINSTALLPATH]v1.1.4322\CONFIG\Machine.Config'
Action='' Name='value' Value='key 2 value'
ElementPath='//configuration/appSettings/add[1]' Sequence='7' /> </Component> Does
anyone know how to add elements and set their attributes when the element names
are the same? __________ Doug Watts |
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users