In this case I would recommend switching to XmlConfig because you can have 
separate records for install (add entries) and uninstall (remove entries).
Use either AppSearch or custom action Type 51 to set some variable to the full 
path of the XML file and use this variable as a value of File attribute.

Alex



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of md5hans
Sent: Tuesday, June 17, 2008 5:25 AM
To: wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] XmlFile CreateElement


Thanks, that solved my problem!

I have another question related to what I'm trying to do.

The XML-file I want to modify is already installed on the target machine i.e
it is not included in the installation. Where shall I put my XmlFile
statments? The example below installs the xml file settings.xml and then
modifies it, if the file settings.xml was a file already installed what
needs to be changed in the configuration?

<Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder" Name="PFiles">
        <Directory Id="Acme" Name="Acme">
          <Directory Id="INSTALLDIR" Name="Foobar1000">
            <Component Id="Settings"
Guid="F72070F6-AD0F-4dec-8723-66D94A18A7ED">
              <File Id="XmlSettings" Name="settings.xml" DiskId="1"
Source="settings.xml" Vital="yes"/>
              <util:XmlFile Id="XmlSettings1" File="settings.xml"
Action="createElement"
                            Name="InfoType"
ElementPath="//Categories/[EMAIL PROTECTED]'VectorMap'[\]]/InfoTypes"
                            Permanent="no" Sequence="1"/>
...
</Directory>


/Hans



Alexander Shevchuk wrote:
>
> Or you can use the fact that your newly created element does not have
> attribute yet:
>
> //ParentNode/ChildNodes/ChildNode[\[]not(@Name)[\]]
>
>
> Alex
>
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ryan Perlman
> Sent: Monday, June 16, 2008 11:12 AM
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] XmlFile CreateElement
>
> You could also use XmlConfig.
>
>>From an xpath point of view you can use something like so in your
XmlSetting2 which would get you the 3rd child element.
>
> "//ParentNode/ChildNodes/ChildNode[\[]3[\]]
>
> Ryan
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of md5hans
> Sent: Monday, June 16, 2008 6:54 AM
> To: wix-users@lists.sourceforge.net
> Subject: [WiX-users] XmlFile CreateElement
>
>
> Hi!
>
> I have a question about manipulating XML-files. I want to create a new
> element inside an existing node, after the element is created I want to
> set
> some attributes on it.
>
> My problem is that there already exists elements of the kind I want to
> add,
> how can I make the setValue action work on the new element instead of on
> of
> the existing? (the first one)
>
> My XML-file have the following structure
>
> <ParentNode>
>    <ChildNodes>
>        <ChildNode Name="A"/>
>        <ChildNode Name="B"/>
>    </ChildNodes>
> </ParentNode>
>
> And I want to create a new ChildNode element and set the Name value to
> "C".
>
> <util:XmlFile Id="XmlSettings1" File="[INSTALLDIR]settings.xml"
> Action="createElement" Name="ChildNode"
> ElementPath="//ParentNode/ChildNodes" Permanent="no" Sequence="1"/>
> <util:XmlFile Id="XmlSettings2" File="[INSTALLDIR]settings.xml"
> Action="setValue" Name="Name" Value="C"
> ElementPath="//ParentNode/ChildNodes/ChildNode" Permanent="no"
> Sequence="2"/>
>
> when I try this it adds a new empty ChildNode element and modifies the
> name
> of the "A" childnode. I suppose that it's not so suprisning since I do not
> specify which ChildNode element that should be modified...
>
> Should I set the value attribute in createElement and then use that value
> (by using a XPath) when identifying the new child node where I want to set
> the name attribute? If so, how do I set the Text value when defining a
> XPath?
>
> /Hans
> --
> View this message in context:
> http://www.nabble.com/XmlFile-CreateElement-tp17864933p17864933.html
> Sent from the wix-users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>

--
View this message in context: 
http://www.nabble.com/XmlFile-CreateElement-tp17864933p17894334.html
Sent from the wix-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to