Is theres a way to Parse XML using XElement.Parse that won't convert entities to a character?
example:
var xmlText = "<name><firstname>Williáms</firstname></name>";
and if I Parse this using the below:
var element = XElement.Parse(xmlText);
var firstname = element.Element("firstname");
after parsing, firstname
value is now "Williáms"
How can I ignore those entities to change?
Character "&" is illegal in XML elements. "&" will generate an error because the parser interprets it as the start of an character entity.
To be corrective, your Xml should be using CDATA:
var xmlText = "<name><firstname><![CDATA[Williáms]]></firstname></name>";