I have XML data in string and tried to convert that string in to XML using
XmlDocument xl=new XmlDocument();
xl.LoadXml(mystring);
It was not parsing because my string has special character in XML element like below.
<ROOT>
<SUB>
<DATA>name < lastname</DATA>
<DATA>Myname > lastname</DATA>
<DATA>some special character in between text</DATA>
......
.....
</ROOT>
</SUB>
There were many <DATA>
in my XML. It was generating dynamically.
I have tried to change < < > >
< < > >
but it was replacing other XML tags. How to escape above special characters without change other XML tags?
Use below strings in XML
< ==> lesser-than = <
> ==> greater-than = >
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.