I'm using the WixUtilExtension, and  specifically XmlFile, to conditionally 
configure a list of items that eventually appear in a GUI combo box. I have 
several check boxes on an installer dialog and when each is checked (true) I 
want to write to an element into a configeration file. Initially the 
configuration looks like this:

<dropdown name="cmbProduce">
<value code="-" en="" fr=""></value>
</dropdown>
After checking three boxes I expect the configuration to look somethinng like 
this:

<dropdown name="cmbProduce">
<value code="-" en="" fr=""></value>
<value code="APPLES" en="Apples" fr="="Pomme"></value>
<value code="GRAPES" en="Grapes" fr=" Raisin"></value>
<value code="PINEAPPLE" en="Pineapple" fr="Ananas"></value>
</dropdown>
Below is the real output. The "value" element that was already there has been 
deleted. Three new "value" elements are inserted but only the last to be 
inserted has any attributes. The other two elements are empty.

<dropdown name="cmbProduce">
<value code="PINEAPPLE" en="Pineapple" fr="Ananas"/></value><value/>
</dropdown>

Each component tested alone writes correctly to the config file, except for 
deleting the initial element. It's only when I've selected 2 or more items that 
the output gets corrupted.
The sample of the installer markup is below. If anyone anyone can offer 
suggestions on fixing the output  it would be greatly appreciated.
Thanks
Rick
<Component Id="CHECKBOX_Pineapple"  Guid="d5653580-3076-47ed-887f-cff26c7702db">
       <Condition><![CDATA[INSTALLSECRET = "true"]]></Condition>
       <CreateFolder/>
       <util:XmlFile Id="PineappleSetting1" 
File="[INSTALLDIR]/Resources/captions.config"
                     
ElementPath="//captions/dropdowns/commun/dropdown[\[]@name='cmbProduce'[\]]"
                     Action="createElement" Name='value' Sequence='1'
              />
       <util:XmlFile Id="PineappleSetting2" 
File="[INSTALLDIR]/Resources/captions.config"
                     
ElementPath="//captions/dropdowns/commun/dropdown[\[]@name='cmbProduce'[\]]/value"
                     Action="setValue" Name='code' Value="PINEAPPLE" 
Sequence='2'
              />
       <util:XmlFile Id="PineappleSetting3" 
File="[INSTALLDIR]/Resources/captions.config"
                     
ElementPath="//captions/dropdowns/commun/dropdown[\[]@name='cmbProduce'[\]]/value"
                     Action="setValue" Name='en' Value="Pineapple" Sequence='3'
              />
       <util:XmlFile Id="PineappleSetting4" 
File="[INSTALLDIR]/Resources/captions.config"
                     
ElementPath="//captions/dropdowns/commun/dropdown[\[]@name='cmbProduce'[\]]/value"
                     Action="setValue" Name='fr' Value="Ananan" Sequence='4'
              />
</Component>
<Component Id="CHECKBOX_Grapes"  Guid="81ea60af-ab37-4acb-beb1-dbf14baac147">
       <Condition><![CDATA[INSTALLTOPSECRET = "true"]]></Condition>
       <CreateFolder/>
       <util:XmlFile Id="GrapesSetting1" 
File="[INSTALLDIR]/Resources/captions.config"
                     
ElementPath="//captions/dropdowns/commun/dropdown[\[]@name='cmbProduce'[\]]"
                     Action="createElement" Name='value' Sequence='1'
              />
       <util:XmlFile Id="GrapesSetting2" 
File="[INSTALLDIR]/Resources/captions.config"
                     
ElementPath="//captions/dropdowns/commun/dropdown[\[]@name='cmbProduce'[\]]/value"
                     Action="setValue" Name='code' Value="GRAPES" Sequence='2'
              />
       <util:XmlFile Id="GrapesSetting3" 
File="[INSTALLDIR]/Resources/captions.config"
                     
ElementPath="//captions/dropdowns/commun/dropdown[\[]@name='cmbProduce'[\]]/value"
                     Action="setValue" Name='en' Value="Grapes" Sequence='3'
              />
       <util:XmlFile Id="GrapesSetting4" 
File="[INSTALLDIR]/Resources/captions.config"
                     
ElementPath="//captions/dropdowns/commun/dropdown[\[]@name='cmbProduce'[\]]/value"
                     Action="setValue" Name='fr' Value="Raisin" Sequence='4'
              />
</Component>






------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to