XML has a set of special characters that cannot appear in element/attribute names and values: &, <, >, ” and ‘. For example, <entityText>Mark & Spencer’s</entityText> is not valid. The valid equivalent is <companyName>Mark &amp; Spencer&apos;s</companyName>. Here is the list of XML special characters and their entity names:










There is a nice utility method in .NET which does this conversion when working with such XML: System.Security.SecurityElement.Escape().