View Full Version : XML File Changes

08-02-2005, 03:29 PM
I am looking for some help on implementing xml file update in a Windows installer project, using the XML File Changes view. Has anyone used this feature? Are there any available samples or is there a tutorial of some kind?

My problem is this:
In a file like the Tomcat web.xml, there are multiple instances of the same element tags (<param-name>, <param-value>). How should I use the XML File Changes view to locate and update one out of these multiple tags of the same name.
Also, instead of updating the xml file that was created during installation, the installer creates a new copy, overwriting the existing one.

I'm wondering if I'm going about this all wrong, considering the problems I'm having. A sample or a tutorial, therefore, would be helpful.

Is there any other method to implement XML file update without resorting to script programming?

08-04-2005, 08:39 PM
Found solution in a message thread from rsinclair (thank you!) under InstallShield 10.5 Windows Installer projects forum:

The tree structure in the XML File Changes View is not to be viewed as the actual structure of the xml file, but as a set of XPath queries. XPath is also the method to be used to search for specific elements/tags within an xml file to make updates.

Now I have another problem - the installer throws an 'error 27520' (error opening file) when trying to open the xml file for update. The file (web.xml) is created/installed as part of product installation. I've tried everything I could think of, including setting attributes and overwriting system properties for the file, but no luck.

Please help!

Aaron Young
08-18-2005, 10:45 AM
I'm having this same problem and was wondering if you had made any progress since your last post?


- Aaron.

Aaron Young
08-18-2005, 11:18 AM
OK, I figured out my problem, I didn't have a well formed XML file (was missing a root node.)

It's also not obvious how to Update existing attribute values; if you select Append Value it'll do just that, instead of replacing it.

Instead, I found you need to insert entries to Remove the attributes first, then insert entries to Create the attributes.

This seems to work well.


- Aaron.

08-18-2005, 11:38 AM
I've narrowed my problem (with error 27520) down to the DOCTYPE declaration in the xml file. If this declaration is present then the error appears.

As was pointed out by someone else having this same problem, the error message is misleading - the problem is with reading(parsing?) the xml in the file, and not with opening the file as the error message says (in his case it had to do with the well-formedness of the xml as well - just like yours).

With the DOCTYPE declaration the installer is trying to perform DTD schema verification which fails (not going into details here). Without the DOCTYPE it works fine.
There are ways to bypass/ignore DOCTYPE declarations using the XML API functions in scripting, DLL (even XSLT I think) implementations. But the XML File Changes View in the Windows Installer is pure XPath, and I have yet to find a way to do the bypas/ignore in XPath. If there is a way then please let me know.

The problem I'm gonna have is with upgrades - updating existing xml files that already contain DOCTYPE declaration(s). The DOCTYPE declarations are not required and can be removed so there will not any problems for a new install. I have a couple of alternative solutions to solve the upgrade problem but they invlove some scripting/programming, which I'm trying to avoid.

04-10-2006, 10:07 AM

There is a HotFix for the Doctype problem published by Macrovision at this link, for version 10.5:


Does anybody know if this fix works also for later versions? I have 11.5.