You're welcome :)
Presumably it is so you can use properties to vary the element path at run
time. Things like [PLUGIN]/Licence := 1234567890

-----Original Message-----
From: keith.doug...@statcan.gc.ca [mailto:keith.doug...@statcan.gc.ca] 
Sent: 16 November 2012 15:42
To: wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] util:XmlFile

Ah! Let's see if that does the trick ... why is this formatted?

Strange effect, in any case.

Does work to escape the []s, though. 

Thanks,


Keith Douglas
Statistics Canada | 170 Tunney's Pasture Driveway, Ottawa ON K1A 0T6
Statistique Canada | 170, promenade Tunney's Pasture, Ottawa ON K1A 0T6
keith.doug...@statcan.gc.ca Telephone | Téléphone 613-951-4405 Facsimile |
Télécopieur 613-951-1966 Government of Canada | Gouvernement du Canada 


-----Original Message-----
From: Peter Shirtcliffe [mailto:pshirtcli...@sdl.com]
Sent: November-16-12 10:29 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] util:XmlFile

>From the help for ElementPath

" Note that this is a formatted field and therefore, square brackets in the
XPath must be escaped. In addition, XPaths allow backslashes to be used to
escape characters, so if you intend to include literal backslashes, you must
escape them as well by doubling them in this attribute. The string is
formatted by MSI first, and the result is consumed as the XPath."

The [ and ] must be escaped. See
msdn.microsoft.com/library/aa368609(VS.85).aspx

-----Original Message-----
From: keith.doug...@statcan.gc.ca [mailto:keith.doug...@statcan.gc.ca]
Sent: 16 November 2012 15:14
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] util:XmlFile

Hi everyone,

I have a small testing (to teach myself how to do these things) installer
that basically just uses util:XmlFile to edit a config file

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";
xmlns="http://schemas.microsoft.com/wix/2006/wi";>
  <Product Id="e5ea734a-3c94-45ec-946d-a8e8892e5e6a"
UpgradeCode="a6f5f4cf-3632-4e0a-a3fc-322dca11bc47" Version="1.0.0.0"
Language="1033" Name="GeneralSettingsChange-20121116095537"
Manufacturer="Statistics Canada" Codepage="1252">
    <Package InstallerVersion="300" Compressed="yes"
InstallScope="perMachine" />
    <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is
already installed. Setup will now exit." />
    <Media Id="1" Cabinet="GeneralSettingsChange-20121116095537.cab"
EmbedCab="yes" />
    <Directory Id="TARGETDIR" Name="SourceDir" />
    <DirectoryRef Id="TARGETDIR">
      <Component Id="Cad8e202a380443cc87afb147a7fb622e"
Guid="2165af6f-7c55-47d8-9373-1476ba4d9ace" DiskId="1">
        <util:XmlFile Id="Cad8e202a380443cc87afb147a7fb622e"
Action="setValue" ElementPath="/configuration/General/add[@key='Password']"
Name="value" Value="test!" File="[ProgramFilesFolder]\Statistics
Canada\Dialer 3\GeneralSettings.xml" SelectionLanguage="XPath" Sequence="1"
/>
      </Component>
    </DirectoryRef>
    <Property Id="Creator" Value="STATCAN\dougkei" />
    <Feature Id="MainApplication" Title="Main Application" Level="1">
      <ComponentRef Id="Cad8e202a380443cc87afb147a7fb622e" />
    </Feature>
  </Product>
</Wix>

It is supposed to change (for the sake of testing figuring out how to do a
more generalized front end I'm building)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <General>
    <add key="UserId" value="m3000"/>
    <add key="Password" value="test"/>
  </General>
</configuration>

To:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <General>
    <add key="UserId" value="m3000"/>
    <add key="Password" value="test!"/>
  </General>
</configuration>

Unfortunately this seems to change the wrong element; I get:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <General>
    <add key="UserId" value="test!"/>
    <add key="Password" value="test"/>
  </General>
</configuration>

Am I using XPath incorrectly? I tried an XPath testing site
(http://www.mizar.dk/XPath/Default.aspx) which seems to confirm my
expectations; I can only conclude that I'm missing something or there is a
bug in util:XmlFile ...

Any assistance welcome!



Keith Douglas
Statistics Canada | 170 Tunney's Pasture Driveway, Ottawa ON K1A 0T6
Statistique Canada | 170, promenade Tunney's Pasture, Ottawa ON K1A 0T6
keith.doug...@statcan.gc.ca Telephone | Téléphone 613-951-4405 Facsimile |
Télécopieur 613-951-1966 Government of Canada | Gouvernement du Canada 



-----------------------------------------------------------------------------
-
Monitor your physical, virtual and cloud infrastructure from a single web
console. Get in-depth insight into apps, servers, databases, vmware, SAP,
cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
SDL PLC confidential, all rights reserved.
If you are not the intended recipient of this mail SDL requests and requires
that you delete it without acting upon or copying any of its contents, and we
further request that you advise us.
SDL PLC is a public limited company registered in England and Wales.
Registered number: 02675207.
Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6
7DY, UK.


-----------------------------------------------------------------------------
-
Monitor your physical, virtual and cloud infrastructure from a single web
console. Get in-depth insight into apps, servers, databases, vmware, SAP,
cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

-----------------------------------------------------------------------------
-
Monitor your physical, virtual and cloud infrastructure from a single web
console. Get in-depth insight into apps, servers, databases, vmware, SAP,
cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to