cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
LeTjock
Level 3

XML file Changes

I have a problem with writing some changes to an XML-file.

Im using basic MSI project and have made a dialog where the user can configure 1-5 different database connections. These connections should be written to an sql.config file.

I've tried to import and modify in XML File Change in IS2008. But when the installation is complete the sql.config files does look very strange. So I started on an new sql.config file from scratch and tried to add the data through XML File Changes, but can't get it right.

Please help point out what I'm doing wrong.
Screendump Installshield

When I use the "Text XML File Install Changes..." in the IDE i get this:
[CODE]











[/CODE]

After the installation has complete i have this in my config file:

























Not quite the result I expected..
Labels (1)
0 Kudos
(4) Replies
Christopher_Pai
Level 16

I don't have the exact syntax in front of me, but basically you need to use parent | child | sibling type directives in your XPATH to define the relationship between the nested elemnts. Also use the Test XML Changes feature to help flush out the bugs without having to build and run your install.
0 Kudos
LeTjock
Level 3

My XPath Query looks like this

//database[@name="[PATRA_CN1_TITLE]"]
//database[@name="[PATRA_CN3_TITLE]"]
//database[@name="[PATRA_CN2_TITLE]"]
//database[@name="[PATRA_CN1_TITLE]"]/connection_string[@value="[PATRA_CN1_CONNECTIONSTRING]"]
//database[@name="[PATRA_CN2_TITLE]"]/connection_string[@value="[PATRA_CN2_CONNECTIONSTRING]"]
//database[@name="[PATRA_CN3_TITLE]"]/connection_string[@value="[PATRA_CN3_CONNECTIONSTRING]"]
//database[@name="[PATRA_CN1_TITLE]"]/provider[@assambly="" and @brand="31"
0 Kudos
LeTjock
Level 3

After some more tests Ive discoverd that it must be the XPath Query order that must be changed.

New order needs to be
[CODE]
//database[@name="[PATRA_CN1_TITLE]"]/connection_string[@value="[PATRA_CN1_CONNECTIONSTRING]"]
//database[@name="[PATRA_CN1_TITLE]"]/provider[@assambly="" and @brand="31"
//database[@name="[PATRA_CN1_TITLE]"]
//database[@name="[PATRA_CN2_TITLE]"]/connection_string[@value="[PATRA_CN2_CONNECTIONSTRING]"]
//database[@name="[PATRA_CN2_TITLE]"]
//database[@name="[PATRA_CN3_TITLE]"]/connection_string[@value="[PATRA_CN3_CONNECTIONSTRING]"]
//database[@name="[PATRA_CN3_TITLE]"]
[/CODE]

Because PATRA_CN1_TITLE change at installation the node connection_string doesn't get any match to the database node.

How do i change the order of the XPath manually?
0 Kudos
LeTjock
Level 3

Solved it by first import XML File and only change the connection_string nodes. Than import the file again in the XML File Change tool and this time I only change the databas name elements.

No beautiful solution but it worked...
0 Kudos