I am trying to load an xml file into a string as below:
System.IO.StreamReader myFile = new System.IO.StreamReader(@"C:\Users\kuruvilla.philip\Desktop\Files\sample1.xml");
String myString = myFile.ReadToEnd();
However I need to check if there are illegal variations of & without spaces in the string loaded in mystring.
for eg: &P (it always needs to be & without spaces)
So I need to correct it in the above case and update it as & in every occurrence.
How to accomplish this?
&in it. Then check if the string contains the ampersand and if it does, validate it against the list of valid attributesCDATAsections? Comments? And someone smart is bound to find a way to exploit that behaviour for nefarious purposes! :D TLDR: Make the guy who creates the XML create valid XML and you're done :)