I don't see any other attributes on XmlFile that would allow you to
specify node insertion idx/before/after/etc so I think if you need that
level of capability you'll have to enhance XmlFile (and share :-))
________________________________
From: Rory Clark [mailto:[EMAIL PROTECTED]
Sent: Friday, April 27, 2007 1:42 PM
To: LEMIRE, JOHN; wix-users@lists.sourceforge.net
Subject: RE: [WiX-users] Looking for a sample code for XML
manipulation...
I have one more wrinkle for you. Is there a way add the new node at the
beginning of the element list?
Thanks!
Rory
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of LEMIRE,
JOHN
Sent: Friday, April 27, 2007 1:23 PM
To: wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] Looking for a sample code for XML
manipulation...
// Create a new empty <add> tag...
<util:XmlFile Id="xf.1" File="web.config" Action="createElement"
Name="add" ElementPath="/configuration/system.web/httpModules"
Sequence="1"/>
// Add a key attribute to the <add> tag that doesn't have one yet...
<util:XmlFile Id="xf.2" File="web.config" Action="setValue" Name="key"
Value="SomeNameSpace.Type1"
ElementPath="/configuration/system.web/httpModules/add[\[]not(@key)[\]]"
Sequence="2"/>
// Add the value attribute to the <add> tag with the correct key
value...
<util:XmlFile Id="xf.3" File="web.config" Action="setValue" Name="value"
Value="Type1Handler"
ElementPath="/configuration/system.web/httpModules/[EMAIL PROTECTED]'SomeName
Space.Type1'[\]]" Sequence="3"/>
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rory Clark
Sent: Friday, April 27, 2007 12:36 PM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Looking for a sample code for XML manipulation...
Preface: I found the sample located at
http://www.tramontana.co.hu/wix/lesson5.php#5.11 for manipulating XML
files and creating elements and assigning attribute values.
However, it does not quite cover our use case here.
Take this snippet of a web.config file:
<configuration>
<system.web>
<httpModules>
<add type="SomeNameSpace.Type1" name="Type1Handler"
/>
<add type="SomeNameSpace.Type2" name="Type2Handler"
/>
</httpModules>
</system.web>
</configuration>
We have code that will a WiX script, <wix:XmlFile Id="WCXml1"
File="[MODULETARGETDIR]web.config" Action="createElement" Name="add"
ElementPath="//configuration//system.web//httpModules" Sequence="1" />
that will add a new "add" element so that it looks like this:
<configuration>
<system.web>
<httpModules>
<add type="SomeNameSpace.Type1" name="Type1Handler"
/>
<add type="SomeNameSpace.Type2" name="Type2Handler"
/>
<add />
</httpModules>
</system.web>
</configuration>
Now we need to grab that new element and add the type and name attribute
values for it. There is probably an XPath construct for this, but I'm
not finding it at the moment.
Any help would be appreciated.
Thanks!
Rory
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users