Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Illegal Syntax Expecting valid start name character

How do I escape the & in the app settings? I've tried \ but didn't work?

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="preset" value="iPhone & iPod Touch"/>
    </appSettings>
</configuration>

The & in the preset key value causes error Illegal Syntax Expecting valid start name character

like image 534
benni_mac_b Avatar asked Jun 08 '12 07:06

benni_mac_b


2 Answers

You shouldn't escape it, bur rather encode it to &amp;:

<add key="preset" value="iPhone &amp; iPod Touch"/>
like image 191
Fredrik Mörk Avatar answered Nov 15 '22 12:11

Fredrik Mörk


Try &amp;

Try the above the string instead of &

like image 41
Rajesh Subramanian Avatar answered Nov 15 '22 13:11

Rajesh Subramanian