Edit XML file - twice!

Having trouble running Advanced Installer? Got a bug to report? Post it all here.

Edit XML file - twice!

Postby PhilB » Tue Apr 12, 2011 10:28 am

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
PhilB
 
Posts: 69
Joined: Fri Jul 06, 2007 4:13 pm

Re: Edit XML file - twice!

Postby mihai.petcu » Tue Apr 12, 2011 12:34 pm

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
http://www.advancedinstaller.com/
mihai.petcu
 
Posts: 3457
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Postby PhilB » Tue Apr 12, 2011 12:49 pm

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
PhilB
 
Posts: 69
Joined: Fri Jul 06, 2007 4:13 pm

Re: Edit XML file - twice!

Postby mihai.petcu » Tue Apr 12, 2011 1:48 pm

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
http://www.advancedinstaller.com/
mihai.petcu
 
Posts: 3457
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Postby PhilB » Mon Apr 18, 2011 5:24 pm

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
PhilB
 
Posts: 69
Joined: Fri Jul 06, 2007 4:13 pm

Re: Edit XML file - twice!

Postby mihai.petcu » Tue Apr 19, 2011 12:46 pm

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
http://www.advancedinstaller.com/
mihai.petcu
 
Posts: 3457
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Postby PhilB » Tue Apr 19, 2011 12:57 pm

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
PhilB
 
Posts: 69
Joined: Fri Jul 06, 2007 4:13 pm

Re: Edit XML file - twice!

Postby mihai.petcu » Wed Apr 20, 2011 9:19 am

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
http://www.advancedinstaller.com/
mihai.petcu
 
Posts: 3457
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Postby PhilB » Wed Apr 20, 2011 1:26 pm

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
PhilB
 
Posts: 69
Joined: Fri Jul 06, 2007 4:13 pm

Re: Edit XML file - twice!

Postby mihai.petcu » Thu Apr 21, 2011 12:56 pm

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
http://www.advancedinstaller.com/
mihai.petcu
 
Posts: 3457
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Postby PhilB » Thu Apr 21, 2011 12:56 pm

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
PhilB
 
Posts: 69
Joined: Fri Jul 06, 2007 4:13 pm

Re: Edit XML file - twice!

Postby mihai.petcu » Fri Apr 22, 2011 12:35 pm

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
http://www.advancedinstaller.com/
mihai.petcu
 
Posts: 3457
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Postby amf » Fri Jan 13, 2012 1:47 am

Is this on the list still to be fixed, because the issue is still there. Thanks.
amf
 
Posts: 9
Joined: Fri Aug 28, 2009 7:04 pm

Re: Edit XML file - twice!

Postby mihai.petcu » Fri Jan 13, 2012 2:54 pm

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
http://www.advancedinstaller.com/
mihai.petcu
 
Posts: 3457
Joined: Thu Aug 05, 2010 8:01 am

Re: Edit XML file - twice!

Postby amf » Tue Jan 31, 2012 3:35 pm

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:

viewtopic.php?f=2&t=20384
amf
 
Posts: 9
Joined: Fri Aug 28, 2009 7:04 pm

Next

Return to Common Problems

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests