XML Config with no XML Escaping - Advanced Installer Community
pimboden40
Posts: 22
Joined: Wed Jun 04, 2014 3:42 pm

XML Config with no XML Escaping

Hello
I have imported my config File in my installer so I can add all the needed settings with the session variables filled during the setup.
Image

One of my Installer steps allows the user to select some folders, that I want to add under the xml-element syncPaths.
Image

so the final xml it should look something like this:

Code: Select all

<syncPaths>
  <syncPath value=''selected_folder_1' />
  <syncPath value=''selected_folder_2' />
  <syncPath value=''selected_folder_3' />
</syncPaths>
..
each selected folder should create a new syncPath -element
So I set a Session variable called BTS_XML_SYNC and wanted to have this as the text element on the syncPaths element.
Image
A custom Action creates the "sub-elements" and sets the BTS_XML_SYNC with this text.
Something like this:

Code: Select all

session["BTS_XML_SYNC"] = "<syncPath value=''selected_folder_1' />\n<syncPath value=''selected_folder_2' />\n<syncPath value=''selected_folder_3' />"
The Problem:
This text gets XMl escaped so I get this result:

Code: Select all

<syncPaths>
  <syncPath value=''selected_folder_1' />
  <syncPath value=''selected_folder_2' />
  <syncPath value=''selected_folder_3' />
</syncPaths>
..

How can avoid the xml-encoding?

Thank you for your help
Attachments
AIServer3.PNG
AIServer3.PNG (20.08 KiB) Viewed 5540 times
AIServer2.PNG
AIServer2.PNG (114.26 KiB) Viewed 5540 times
AIServer1.PNG
AIServer1.PNG (12.36 KiB) Viewed 5540 times
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: XML Config with no XML Escaping

Hi,

I'm afraid that this is the normal behavior. You can take a look on the Keep single quote in XML Value from turning into &apos; thread which debates a similar subject.

If you really want to use the < and > characters, you can follow the steps below:
- create a new "Text File Update" operation next to your "XML Edit" operation and set the same name for it
- go to the "Append/Create" section and uncheck the "Create file with encoding" option
- go to the "Replace" section and write < in the "Find" field and < in the "Replace" field
- right-click under the "Replace" text and use the "New Search and Replace Operation" option
- write > in the "Find" field and > in the "Replace" field, then click OK
- go in the "Table Editor" page, "InstallExecuteSequence" table and modify the "Sequence" value of the "AI_TxtUpdaterInstall" row from "5101" to "5014"
- build and run the project

Let us know if this helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
pimboden40
Posts: 22
Joined: Wed Jun 04, 2014 3:42 pm

Re: XML Config with no XML Escaping

Worked!!!
You Guys /Girls are fantastic!
Thank you!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: XML Config with no XML Escaping

You're welcome. I'm glad it worked.

Just let us know anytime you need help.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
pimboden40
Posts: 22
Joined: Wed Jun 04, 2014 3:42 pm

Re: XML Config with no XML Escaping

Hello.
After the successful writing,I have another problem with this.
I want to be able to read the Content of this element during the Search -Phase:

I tried to make it with the "normal" Search behavior..
Image
my config file is correct:
Image
but My Session variable is always empty...

all the other session variables are filled..so the search works, except for this special case.

Again..
Thank you for your help
Attachments
AIServer5.PNG
AIServer5.PNG (9.03 KiB) Viewed 5522 times
AIServer4.PNG
AIServer4.PNG (29.72 KiB) Viewed 5522 times
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: XML Config with no XML Escaping

Hi,

I'm afraid I do not fully understand your scenario. Can you please mark the XML element that you want to search from the XML tree?

I see that you want to get the text of the "syncPaths" element, but it does not contain any text. Do you want to get the value of one of the three "syncPath" elements that are found under the "syncPaths" element?

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

Return to “Building Installers”