We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

ipollock
Posts: 137
Joined: Wed Aug 31, 2016 10:46 am

Best way to update XML keys?

I'm currently using part of an installer to update XML keys in various locations within the installer/s.

The current Scenario is as follows: IIS Server application.
1. During install, the user selects http or https using a combo box and this populates a variable called 'IIS_PROTOCOL'.
2. Depending on what the user selects, a second variable called 'USER_PROTO' is populated with a '0' for http or a '1' for https.
3. Both variables are used in the XML files to populate various keys, for example key "User_Proto" value = [USER_PROTO] (which ends up populating the XML field with a '0' or '1' depending on user choice at install time.

Previous method was to update the XML key with a '1' by setting a condition on the Element Settings of the Edit XML File dialogue.
So for example the source XML file would have a key set such as key "User_Proto" value ="0"
The value would be updated if the user during install had decided upon https and there for the condition would be to set the value to "1" if 'IIS_PROTOCOL' =1
The problem is (and this is why we now have the current scenario) this only works correctly if the underlying source has a value = '0' to begin with.

So here is my question, should i move back to the original method and put in two elements per variable, ie. with conditions for http (0) and https (1) just in case the XML source is a 0 or a 1,
or is the current scenario fine.

Thanks in advance.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Best way to update XML keys?

Hi Ian,

Setting the value of an attribute to a property (e.g. key "User_Proto"; value = [USER_PROTO]) is correct and is also the recommended approach in most of the cases. So, in your scenario, that value will be set to either "0" or "1" in the XML file depending on the value of the "USER_PROTO" property.

Just let me know if you have other questions.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ipollock
Posts: 137
Joined: Wed Aug 31, 2016 10:46 am

Re: Best way to update XML keys?

Thanks for your reply Eusebiu, appreciate your advice.

I took over a project recently and had taken your advice on this at that time. During the change process i noted that it had been done
differently. Since then i have been converting the installer to your correct method and things are looking better. During the change process
I have noticed that some settings were not being set correctly but hopefully these are all phased out now. Thanks again.

Ian
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Best way to update XML keys?

You're welcome Ian. Glad to help.

Just let me know if you encounter any problem.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”