benni_mac_b
benni_mac_b

Reputation: 8877

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

Upvotes: 5

Views: 6607

Answers (2)

Rajesh Subramanian
Rajesh Subramanian

Reputation: 6490

Try &amp;

Try the above the string instead of &

Upvotes: 1

Fredrik M&#246;rk
Fredrik M&#246;rk

Reputation: 158319

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

<add key="preset" value="iPhone &amp; iPod Touch"/>

Upvotes: 15

Related Questions