PhilB
Posts: 95
Joined: Fri Jul 06, 2007 4:13 pm

Edit XML file - twice!

Hi,
I am currently using the XML editor to edit a setting in an installed XML config file. The edit is associated with a particular component so if the component is not installed the edit is not performed. This has been working well for quite some while. I now have a requirement to edit another setting in the same XML file. Unfortunately this edit should only be performed when a second (different) component is installed. Presumably, I need to set up a second completely separate edit to achieve this. Is this possible?

Phil
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Hi Phil,
Presumably, I need to set up a second completely separate edit to achieve this.
This is correct. As each .XML edit is associated with a component, to condition the .XML edit for a certain component, you would have to create a new .XML edit associated with that component.

In a different case scenario, if your file is already installed on the target machine, you can try to use our new feature called XML Locator. Here is the tutorial to get you started.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
PhilB
Posts: 95
Joined: Fri Jul 06, 2007 4:13 pm

Re: Edit XML file - twice!

Mihai,
mihai.petcu wrote:This is correct. As each .XML edit is associated with a component, to condition the .XML edit for a certain component, you would have to create a new .XML edit associated with that component.
What I can't work out is how to set up the second edit because this gives a duplicate name error.

Phil
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Hi Phil,

If this doesn't work you can try to add a formatted reference to a public property in the same .XML edit whose value will be set conditioned by the selected component. You can achieve this with the help of "SetProperty" conditioned published events or "Property Set with Formatted" custom actions.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
PhilB
Posts: 95
Joined: Fri Jul 06, 2007 4:13 pm

Re: Edit XML file - twice!

Hi Mihai,
mihai.petcu wrote:If this doesn't work you can try to add a formatted reference to a public property in the same .XML edit whose value will be set conditioned by the selected component. You can achieve this with the help of "SetProperty" conditioned published events or "Property Set with Formatted" custom actions.
I've implemented this and the initial install works fine. The problem I now have is changing the entries in the XML file when one of the components is modified. Because the XML file is associated with a component that is not being modified, it is not edited during the maintenance phase.

Phil
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Hi Phil,

This is the actual intended functionality of the associated .XML file to a component. If the component is not modified, its associated .XML file won't be as well.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
PhilB
Posts: 95
Joined: Fri Jul 06, 2007 4:13 pm

Re: Edit XML file - twice!

Hi Mihai,
mihai.petcu wrote:This is the actual intended functionality of the associated .XML file to a component. If the component is not modified, its associated .XML file won't be as well.
I realise that - my point is that although the proposed solution to my initial query works for an initial installation, it doesn't work when a maintenance operation is performed. Ideally I still need some way of editing the same XML file twice - with the first edit associated with one component and the second edit with another. As this doesn't seem possible I guess I will have to keep the workaround but disable the modify option for now!

Phil
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Hi Phil,

There is another approach to this you can try based on my initial assumption. To avoid the duplicate error, you can have your second .XML update placed in a subfolder with the "Install folder content into the parent folder" option enabled( can be set from the "Properties..." context menu ).

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
PhilB
Posts: 95
Joined: Fri Jul 06, 2007 4:13 pm

Re: Edit XML file - twice!

Hi Mihai,
mihai.petcu wrote: To avoid the duplicate error, you can have your second .XML update placed in a subfolder with the "Install folder content into the parent folder" option enabled( can be set from the "Properties..." context menu ).
I was in the process of trying this exact approach when I got your reply. It seems to do exactly what I need - so problem solved! There is one curious side effect that I can live with, which is that when both components are installed and therefore both edits occur I get a .back file created even though this option is switched off for both edits. In all other circumstances the .back file is not created.

Thanks for your help.

Phil
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Hi Phil,

This is the result of the "Create backup before updating" option in the Install tab of your .XML update. If this option is enabled a backup copy of the original XML file will be created before the update operation takes place. You can disable this option and the file won't be created any more.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
PhilB
Posts: 95
Joined: Fri Jul 06, 2007 4:13 pm

Re: Edit XML file - twice!

Hi Mihai,

When the XML file edit is configured there is an option to "Create backup before updating". If this is selected then a .back file is produced for the XML file. I do not have this option selected in either of my two edits yet the backup file is still produced for the case where both edits are required. Like I said, this is no big deal (for me anyway!).

Cheers,

Phil
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Hi Phil,

This behavior is caused by a bug in Advanced Installer. Thank you for bringing it to our attention, I added it on our TODO list and we will include the fix in a future version.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
amf
Posts: 10
Joined: Fri Aug 28, 2009 7:04 pm

Re: Edit XML file - twice!

Is this on the list still to be fixed, because the issue is still there. Thanks.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Hello,

I have tested this with our latest release and unfortunately cannot replicate the issue.
Can you please create a dummy sample( project and XML file ) which manifests this and send it to us so we can investigate it?

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
amf
Posts: 10
Joined: Fri Aug 28, 2009 7:04 pm

Re: Edit XML file - twice!

PhilB wrote:I do not have this option selected in either of my two edits yet the backup file is still produced for the case where both edits are required.
It still happens and it was a pain to figure out a workaround without having to invent a custom action, so we're leaving behind how we were able to make this work in this thread:

http://www.advancedinstaller.com/forums ... =2&t=20384

Return to “Common Problems”