cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
webwolve
Level 4

XML File Text Substitution

Hi all,

I've spent all morning trying to figure out how to do a simple XML change, but have had no luck thus far. I hope someone can explain to me the steps I need to take to accomplish what I need. So, thanks in advance.

Very simply, I'm installing a file called x.config containing:



providerName="System.Data.SqlClient"
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=data;Integrated Security=True" />


On the fly, I need to simply change the "SQLEXPRESS" text to a variable value I read from an ini file, for example "hello"; So, I read from the ini during the install, get the value, and then need to write it to the XML file in the line above.

This is within an InstallScript project.

Can anyone help? I've not playes with XML files before.

Thanks!
Labels (1)
0 Kudos
(1) Reply
TheTraveler
Level 8

If you are running an installation that runs Install Shield script, then check out this link. I wrote a function that will open up an XML file like web.config and make changes to it by using XML Document COM objects.
0 Kudos