Keep single quote in XML Value from turning into ' - Advanced Installer Community

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!

reo
Posts: 7
Joined: Mon Jun 07, 2010 4:42 pm

Keep single quote in XML Value from turning into '

Heading to the deep end of the pool...

I'd like to have AdvancedInstaller update an app.Config file as an XML file.
to modify this:
<add key="eyeroute.db.sqlconnection" value="server='ORIG_PC\SqlExpress'; trusted_connection=true; Database='tst01'"/>
into:
<add key="eyeroute.db.sqlconnection" value="server='testpc\SqlExpress'; trusted_connection=true; Database='zzz_01'"/>

I found in the tutorial this is accomplished by adding the app.Config file as a regular file,
and then adding a new XML file, and then editing the properties to get to the key
(and it helped to Import the XML file to see exactly how the "Element" and "Attribute Settings"
need to be set to find the particular XML key that I want changed).

And I'd like to change this one setting via a GUI control so the end User can change it.
Again this is tricky but is just an "Installer Parameter" that needs to appear as [MY_PARAMETER].
No problem...
Issue_02_a.JPG
Issue_02_a.JPG (22.06 KiB) Viewed 4248 times
Through trial and error I get all this up and text will update into the config file and even make a backup
(after I hand edited my AIP file to turn the entries for xmlCfg.dll:
  • Config 11265 -> 1025
    Remove 11265 -> 1025
    Rollback 11521 -> 1025
Without the hand editing, the app.Config file is not backed up and no entries are changed or added).

And it sort of works.
The field I am trying to update has single quotes embedded into it because it is a SqlConnection string...
And the single quotes are being converted into the literal text "&apos;"
Actual Resulting line in app.Config:
<add key="eyeroute.db.sqlconnection" value="server=&apos;testpc\SqlExpress&apos;; trusted_connection=true; Database=&apos;zzz_01&apos;"/>

I have taken the GUI element object out of the equation by just trying to add the hardcoded text with single quotes in for the Value of "value",
but that too comes out with the single quotes transforming into "&apos;" text too.

Is there a way to get the "&apos;" out of the string and single quotes in?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Keep single quote in XML Value from turning into &apos;

Hello,

This is the expected behavior. The parser responsible for reading the XML file will (or should) automatically unescape the escaped single quotes. It would be best if you tested this, however.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
reo
Posts: 7
Joined: Mon Jun 07, 2010 4:42 pm

Re: Keep single quote in XML Value from turning into &apos;

I took your advice and did test it.
It does work. (Looks strange but it works.)
Thank you very much!

Return to “Common Problems”