Overview of XML File Changes

InstallShield 2019

Project • This information applies to the following project types:

Basic MSI
DIM
InstallScript
InstallScript MSI
Merge Module
MSI Database
Transform

Design-Time Tasks

The XML File Changes view enables you to define modifications that should be made to an XML file at run time. The typical process for defining those modifications is as follows:

1. If the XML file that you are modifying is part of your installation, add the base XML file to a component in your project through the Files and Folders view.
2. In the XML File Changes view, create an XML file reference for the file that you want to modify.
3. Specify the location for the XML file on the target machine.
4. Specify which feature or features should contain the XML file changes. This may be the same feature that contains the component in step 1, or it may be a different feature.
5. Configure the changes that you want to occur at run time.

You may need to add an MSXML redistributable to your project. For more information, see Run-Time Requirements for XML File Changes.

Run-Time Behavior

The XML File Changes view enables you to configure run-time behavior such as the following:

Add a namespace mapping to an XML file, and add namespace prefixes to elements and attributes.
Create a specified element if it does not already exist.
Modify an element if it exists, but do not create it if it does not exist.
Modify only the first element in the XML file that matches the specified XPath expression, or modify all matching instances.
Remove an element during uninstallation.
Set content for an element.
Create a new attribute during installation, during uninstallation, or both.
Remove an existing attribute during installation, during uninstallation, or both.
Append a string to an existing attribute value during installation, during uninstallation, or both.
For Basic MSI, DIM, InstallScript MSI, Merge Module, MSI Database, and Transform projects: Replace Windows Installer properties in elements, attributes, attribute values, and element content with the appropriate values at run time.
For InstallScript projects: Substitute InstallScript string variables for elements, attributes, attribute values, and element content with the appropriate values at run time.

When an installation that contains XML file changes runs on a target system, MSXML parses the XML file and executes the XPath expressions that are associated with the changes that you configured. The Advanced tab in the XML File Changes view for an XML file shows the XPath expressions that are executed on target systems.

When MSXML finds an area of the XML file that matches the XPath expression, the changes that were configured in the XML File Changes view are made.

For examples of how to create some basic XPath expressions, see Using XPath Expressions to Find XML Data in an XML File.

Note • If the XML file does not exist on the target system at run time and the Always create XML file if it does not already exist check box is selected on the Advanced tab for the XML file, the XML file is created with the XML data that is configured in the XML File Changes view.