Zsolt Kollarits
Posts: 340
Joined: Fri May 29, 2015 10:36 am

IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Fri Feb 09, 2018 2:08 pm

Hi Advanced Installer Support Team,

One of our customer just reported a serious problem: the order of some nodes in one of our web.config files is completely wrong so that our web feature is not working at all.

This is the customeHeaders section in the XML after they upgraded our product to the latest version:
<customHeaders>
<add name="X-UA-Compatible" value="IE=Edge"/>
<!-- add name="X-Frame-Options" value="SAMEORIGIN" / -->
<!-- THE PAGE CAN BE DISPLAYED IN A FRAME -->
<clear/>

This should be the customHeaders section:
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=Edge" />
<!--add name="X-Frame-Options" value="SAMEORIGIN" /--><!-- THE PAGE CAN BE DISPLAYED IN A FRAME -->


The most important thing is that <clear /> should be the first child, otherwise our web.config file is incorrect.

I just checked our .aip project and the order seems to be correct there. I'm attaching an image about the Edit XML File dialog for that particular web.config file. The "clear" node is listed as 1st child. Note: "child" does not have any attributes, so we cannot define an "identifier attribute", but still it should work. There must be a way of securing the order of nodes somehow, AI must have this possibility, otherwise this XML File feature makes no sense.

Questions:
1. How can we defined/correct the order of the nodes?
2. How can be change the order in Edit XML File dialog. Why we can't drag and drop the nodes on the left hand side treeview? We'd like to manage quite big and complex config files with this feature of yours, of course proper order is an important factor.

Please handle this ticket as a serious one, because it's a blocker for our customer.

Best regards,
Zsolt
Attachments
Screenshot_of_EditXMLFile.png
Screenshot_of_EditXMLFile.png (43.64KiB)Viewed 8462 times

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Tue Feb 13, 2018 4:43 pm

Hello Zsolt,

I'm not so sure why this happens. The XML (child) elements should be written at install time in the order (from top to bottom) they are defined in the "XML File" window from "Files and Folders" page.

To further investigate this, can you please send us the AIPs (project files) of your old and new setup package version to support at advancedinstaller dot com so we can investigate and test their settings.

Also, in what regards your request about drag and drop edit of the element order in our "XML File" window we do not have support for dragging and dropping a child element order under his parent element, but we do offer a context menu option to move up and down an XML element with one position each time. Just right click on an XML element and use the "Move Up/Down" option.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Zsolt Kollarits
Posts: 340
Joined: Fri May 29, 2015 10:36 am

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Tue Feb 13, 2018 7:06 pm

Hi Daniel,

First of all thank you for the tip of how to move the nodes up and down, that´s really working.

Furthermore I´d like to let you know that I just sent 2 .aip projects to your email address. You can find the relevant XML files in several folders:
- TheXMLServer.exe.config and TheMFPManager.exe.config -> "Files and Folders" / Application Folder
- 1st web.config -> "Files and Folders" / TWA
- 2nd web.config -> "Files and Folders" / TWA / Client
- 3rd web.config -> "Files and Folders" / TWA / Portal

Please be aware that we just started to use your XML File (Windows Installer) feature, it means we just added our XML files as standard physical XMLs in the previous versions of our product. This can be seen in TheCommonSetup_old.aip.
Starting from TheCommonSetup_new.aip, we would like to import our XMLs in Windows Installer format so that we´ll be able to preserve some of the nodes. Installing the new version over the old one is changing the order of the nodes.

Best regards,
Zsolt

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Wed Feb 14, 2018 12:37 pm

Hello Zsolt,

Thank you for your sent file.

I've run several test case using your sent project and when the XML file is installed by the new product version the XML elements appear in the correct order (just like it is defined in the new project). However, the only test case I was able to find when your related behavior occurs is the following one:

1. install the new version of your product
2. uninstall it; now the "customHeaders" element of your XML file is left in the following state:

Code: Select all

<customHeaders>
        <add name="X-UA-Compatible" value="IE=Edge"/>
        <!-- add name="X-Frame-Options" value="SAMEORIGIN" / -->
        <!--  THE PAGE CAN BE DISPLAYED IN A FRAME  -->
</customHeaders>
This happens because you did not check the "Remove element on uninstall option" for your "customHeaders" element and for its "add" child element. Only the "clear" child element is uninstalled.

3. install again the new version of your product; now when the "clear" child element is installed it will be added after all the child items of the "customHeaders" element; this is our implementation

To avoid this behavior, as a solution, you can leave unchecked the "Remove element on uninstall option" for your "clear" child element too.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Zsolt Kollarits
Posts: 340
Joined: Fri May 29, 2015 10:36 am

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Thu Feb 15, 2018 10:27 am

Hi Daniel,

Thank you for your comprehensive explanation, I´ll perform another round of testing then. But before I start it I´d like to ask how could we UNCHECK the "Remove element on uninstall" checkbox for ALL the nodes in an XML file. Your previous letter highlighted the potential problem of our implementation. Since we´d like to keep the original version of our .config files and overwrite some of the nodes only, we´ll need to preserve all the nodes by unchecking "Remove element on uninstall" checkbox. Otherwise problems like what I described in my first letter might occur later on. The safest would be to uncheck that checkbox for all the nodes and then define which nodes should be overwritten and which ones should be kept.

As we have 5 config files that we´d like to preserve and the longest has 290 lines, you can imagine how many nodes we have. Clicking through all of them at Edit XML File dialog and unchecking "Remove element on uninstall" is not a real option here. Furthermore I know there is another way of doing it: opening up our .aip file and changing the Flag of each node from 14 to 4, but this is also something we don´t want to do. We might get new config files or else we have to replace some of them later on, that´s why we need an "official" solution from your side. E.g. a button on the ribbon or in the context menu saying "use this option for all nodes".

Could you please consider how this feature could be improved by you?

Best regards,
Zsolt

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Tue Feb 20, 2018 10:06 am

Hello Zsolt,

Using our current implementation you could bulk edit multiple XML items. You should just make sure you select all the elements of your XML file. For instance you can proceed like this:

1. select the first element
2. while keeping the [SHIFT] key pressed select the last element

This way all the XML items between the first and last element will be selected. Now in the right pane you will see all the flags (common for all the selected items) you could bulk edit.

Note: it the selection will include XML comments too, then the related flag cannot be bulk edited because this flag is not available for XML comment items too. In this case you should configure multiple selections, in turn, which consists only in XML elements.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Zsolt Kollarits
Posts: 340
Joined: Fri May 29, 2015 10:36 am

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Tue Feb 20, 2018 4:48 pm

Hi Daniel,

Thanks again for your hints, I could not set the value of that checkbox on my multiple selection due to some comment nodes in my selection. Your tip helped me to understand that I should exclude the comment nodes.

Best regards,
Zsolt

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Wed Feb 21, 2018 11:06 am

You are always welcome Zsolt.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Zsolt Kollarits
Posts: 340
Joined: Fri May 29, 2015 10:36 am

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Wed Mar 07, 2018 11:57 am

Hi Daniel,

You proposed in your first letter in this thread that:
To avoid this behavior, as a solution, you can leave unchecked the "Remove element on uninstall option" for your "clear" child element too.

Now our approach is the following:
1. "Remove element on uninstall option" checkbox is TURNED OFF for ALL of our nodes in the XML file.
2. For the nodes we´d like to overwrite by the values coming from the new product we have
a) "Create element if it doesn´t already exists" ENABLED
b) "If the elements is found" also ENABLED + Update subsetting is set to "First matching"
c) Condition is the default 1
3. For the nodes we´d like to keep their values modified by the customer
a) "Create element if it doesn´t already exists" ENABLED
b) "If the elements is found" DISABKED
c) Condition is the default 1

Even though we use these settings which should work in theory, we still found some problematic scenarios: the order of the nodes can be still wrong. For more details please check the txt and png files I´m attaching.

Our goal is: the subnodes (clear and error) of httpErrors node, you can see on the pngs, have to be always overwritten (updated) based on what is coming with the new product. These values should not be modified by the customer, so we want to just simply take the newest values from our newest product. How could we achieve this? As I said for more info please check the attachments.

Best regards,
Zsolt
Attachments
HttpErrors section changes.txt
(3.1KiB)Downloaded 270 times
Element Settings for ALL the nodes (httpErrors, clear, errors have the same settings).png
Element Settings for ALL the nodes (httpErrors, clear, errors have the same settings).png (26.8KiB)Viewed 8368 times
Attributes for all the error nodes with some identified attributes (always statuscode and substatuscode).png
Attributes for all the error nodes with some identified attributes (always statuscode and substatuscode).png (28.01KiB)Viewed 8368 times

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Thu Mar 08, 2018 4:39 pm

Hello Zsolt,

I'm not sure why this happens. I've tested the scenario but cannot replicate the behavior.

Could you please send us again to support at advancedinstaller dot com the old version of your project, the new version of the project and the intermediary state of the XML file after being edited by the user so I can fully test you scenario again?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Zsolt Kollarits
Posts: 340
Joined: Fri May 29, 2015 10:36 am

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Fri Mar 09, 2018 9:43 am

Hi Daniel,

I just sent you some files and some more explanation to you.

Best regards,
Zsolt

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Wed Mar 14, 2018 10:51 am

Hello Zsolt,

Thank you for your sent files. I've tested the scenario and I replicated the behavior.

Unfortunately, after debating this with our development team it seems this is our implementation. Because several of the child elements of "httpErrors" already exists at install/upgrade time, the <clear> element will be created on top of them, after the last child element in list.

Code: Select all

<httpErrors errorMode="DetailedLocalOnly">
  <error statusCode="401" subStatusCode="-1" path="Redirect401.html" responseMode="File" />
  <error statusCode="401" subStatusCode="1" path="Redirect401.html" responseMode="File" />
  <error statusCode="401" subStatusCode="2" path="Redirect401.html" responseMode="File" />
  <error statusCode="404" subStatusCode="-1" path="../error.html?t=auth" responseMode="Redirect" />
  <error statusCode="404" subStatusCode="1" path="../error.html" responseMode="Redirect" />
  <error statusCode="404" subStatusCode="2" path="../error.html" responseMode="Redirect" />
  <clear/>
</httpErrors>
Unfortunately there is nothing we can do for you in this case. Thank you for your understanding.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Zsolt Kollarits
Posts: 340
Joined: Fri May 29, 2015 10:36 am

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Wed Mar 14, 2018 11:09 am

Hi Daniel,

We understand this is your implementation and happy to make modification in my sample project. Do you have any proposals?

The only thing we´d like to do is always taking over the latest "httpErrors" block from the new .config XML file, I think it´s nothing special. In one of your previous letters (for a previous issue) you suggested to
"
you can leave unchecked the "Remove element on uninstall option" for your "clear" child element too.
"
Changing those checkboxes would fix this most recent issue, while it would put back the old, it´s getting more and more confusing. I´m sure you understand us that we don´t do anything special or tricky here: we only want to use your feature for what it has been designed, to keep some nodes of an XML file and overwrite/refresh the rest of the nodes. The XML file we sent you is very similar to our official XML, it´d be highly appreciated if we could somehow make the upgrade scenario working.

Thanks in advance!

Best regards,
Zsolt

Zsolt Kollarits
Posts: 340
Joined: Fri May 29, 2015 10:36 am

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Wed Mar 14, 2018 4:10 pm

Hi Daniel,

In my previous letter I forgot to mention that apart from our problem with <clear/> tag we also have a - we think - separate issue which is not really about the order of nodes. I described that issue too in my letter that I sent via WeTransfer:
"
2. New <location> nodes will appear at the end of the file. For more info check my comment in Modified_Web.config.
3. A similar issue as of the problem with <location> nodes:
<system.web>
<authentication>
<forms>
A second <forms> node appears in <authentication> after the upgrade, although only 1 should be there. For more info also check my comments in Modified_Web.config.
"

Could you please have a look at that issue too. Our goal is workarounding somehow these 3 (or 2) remaining problems somehow.

Best regards,
Zsolt

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: IMPORTANT: Wrong order of nodes in XML .config file after upgrade

Thu Mar 15, 2018 4:30 pm

Hello Zsolt,

Let me review once again the whole upgrade scenario based on the comments from your sent modified config file (I didn't noticed them to be honest). Also, I'll try to see if there is anything you can do to accomplish all of your requirements, but taking into consideration the structure of your XML elements (many duplicated elements name which you cannot distinguish between them) I'm not to enthusiastic that there is any possible solution.

However, please give me some time to re-analyze all of your problems and try to search for any possible magic solution. :)

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”