EDIT: I have edited my post…
Working on a project (c#), I have a string (password) within an XML file (app.config) which it value contains ‘&’ character. Suppose it some thing like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="MainConnectionString" value="Data Source=MyDataSource;InitialCatalog=MyInitialCatalog;User ID=MyUserID;Password=ynhub&59=k31!890" />
</appSettings>
</configuration>
But compiler shows me an error and a squiggly blue line appears under 59 indicates that ‘character 5 hexadecimal value is illegal in an XML name’
How can I remove this error?
XML starts special characters with an & character, i.e. the famous &, < (<) and > (>).
For this reason you cannot use & in your XML without converting it to &. For example even in HTML links it’s not allowed (but still common) to write:
It has to be written as:
Noone is doing it but HTML & XML specify it that way and especially XML is very strict about it.