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

XML file changes are not updating existing elements

I have XML changes configured for an element. If the element does not exist in the xml file, then it is added and the content set correctly.

Starting file content:




Add element data:


My property value inserted here.


However if the element exists in the file like:





then the installer will not set the content of Key. Why? Has anyone else seen this? I am having the same problem with attributes. They are not updated. If I delete the element from the source file and then run the installer, the element is created and added correctly. I have tried many combinations of the options with no luck.

Installscript MSI project running on Win7 64 bit.

Note: Test XML File Install Changes produces output as shown:

Input:





Result:


[MYPROPERTY]


Thanks in advance.
Labels (1)
0 Kudos
(4) Replies
hidenori
Level 17

Actually it works fine on my end. The content of the Key element is set to the value of the MYPROPERTY property in both cases where the Key element exists and doesn't exist in the original .xml file. I include the screenshot of the XML view that I have configured. A verbose log may help you troubleshoot the issue. KB article Q104807 explains how to create the log.
0 Kudos
todd_gomon
Level 3

This is my log when tag exists in source file:

...
InstallShield 13:53:16: Installing XML Component 'Server.config'
InstallShield 13:53:16: Installing XML file 'C:\Program Files\Comapny\Product\Server\Server.config'
InstallShield 13:53:16: Using MSXML version 6
InstallShield 13:53:16: Processing XPath '//'
InstallShield 13:53:16: Processing XPath '//Key'
InstallShield 13:53:16: Saving XML file 'C:\Program Files\Comapny\Product\Server\Server.config'
InstallShield 13:53:16: Formatting XML document
InstallShield 13:53:16: Using MSXML version 6
InstallShield 13:53:16: Loading stylesheet
InstallShield 13:53:16: Successfully loaded stylesheet
InstallShield 13:53:16: Using MSXML version 6
InstallShield 13:53:16: Done Formatting XML document
...

Without tag in source file:

InstallShield 14:03:11: Installing XML Component 'Server.config'
InstallShield 14:03:11: Installing XML file 'C:\Program Files\Comapny\Product\Server\Server.config'
InstallShield 14:03:11: Using MSXML version 6
InstallShield 14:03:11: Processing XPath '//'
InstallShield 14:03:11: Processing XPath '//Key'
InstallShield 14:03:11: XPath '//Key' not found, creating
InstallShield 14:03:11: Creating element: Name=Key, Namespace=
InstallShield 14:03:11: Creating text node 19D35623D76E4BF0D739A183E46CEFBC4C06F448B4D4F3E63D590CD8034D06CA
InstallShield 14:03:11: Saving XML file 'C:\Program Files\Comapny\ProductServer\Server.config'
InstallShield 14:03:11: Formatting XML document
InstallShield 14:03:11: Using MSXML version 6
InstallShield 14:03:11: Loading stylesheet
InstallShield 14:03:11: Successfully loaded stylesheet
InstallShield 14:03:11: Using MSXML version 6
InstallShield 14:03:11: Done Formatting XML document

I am using the same settings as shown in your image. Any ideas?
Thanks
0 Kudos
hidenori
Level 17

This is my log when the tag does not exist:

InstallShield 13:18:16: Installing 1 XML component(s)
InstallShield 13:18:16: Installing XML Component 'NewXmlFile.xml'
InstallShield 13:18:16: Installing XML file 'C:\Users\Testlab\Pictures\NewXmlFile.xml'
InstallShield 13:18:16: Using MSXML version 6
InstallShield 13:18:16: Processing XPath '//'
InstallShield 13:18:16: Processing XPath '//Key'
InstallShield 13:18:16: Creating text node My property value inserted here.
InstallShield 13:18:16: Saving XML file 'C:\Users\Testlab\Pictures\NewXmlFile.xml'
InstallShield 13:18:16: Formatting XML document
InstallShield 13:18:16: Using MSXML version 6
InstallShield 13:18:16: Loading stylesheet
InstallShield 13:18:16: Successfully loaded stylesheet
InstallShield 13:18:16: Using MSXML version 6
InstallShield 13:18:16: Done Formatting XML document

Are you using InstallShield 2012? Can you try testing it with a brand new InstallScript MSI project, and see if you can reproduce?
0 Kudos
todd_gomon
Level 3

It is 2012.
I did find the problem. The appSearch and ISXmlAppSearch actions were in both the UI and Execute sequences. Even though the ISXmlAppSearch is set to 'Immediate Execution' and 'Execute only once', it was executing twice as shown in the log file. The second execution during the execute sequence would delete the property value that was set during the UI sequence. I am using the app search to pre-populate the property if it already exists on the target system.

Thanks
0 Kudos