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

Reply via email to