I have an XML file that users can change and add some different text to certain attributes and then upload to my tool. The problem is that they sometimes include <
and >
in the values of the attributes. I want to change that to <
and >
.
For instance:
<title value="Tuition and fees paid with (Percent<5000) by Gender" />
Loading this causes an error using the following code:
XmlDocument smldoc = new XmlDocument();
xmldoc.LoadXml(xmlString);
The issue I have is that I need all the attributes which can be user generated to be in an html entity for <
and >
. The problem is that I cannnot do just a .Replace("<", "<")
because the actual XML file needs those.
How is this done easily? The code is C#.Net.