I have an XML string and I have to parse that XML in C# (using xml.LoadXml()). But in the XML there are some special characters like <
, >
, &
, "
, etc. I have written the replace of these special characters with its escape characters.
But the problem is that <
and >
is replaced by escape characters for the XML tag as well. How can I resolve this?
I want to replace only extra special characters and not XML tag values.
XML:
<?xml version="1.0" encoding="utf-8"?>
<Objects>
<Object>
<t2>test<
</t2>
<t3>test</t3>
<s4>76</s4>
<s7>321</s7>
<t4>test</t4>
<t6>test&</t6>
<t8>NY</t8>
</Object>
</Objects>