Quantcast
Channel: Writing special characters to xml in c# - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Writing special characters to xml in c#

$
0
0

I am using LINQ to XML to write an element to an xml document. The problem i am having is that the string i try to write to the xml element has characters such as &, <, > and ".

When i write it to xml using the following code,

XElement Config= new XElement("Student", new XElement("ID", "><&\""));

I dont get these special characters being written to the XML document. Instead i get things like &lt; for < and &gt; for >. How can i escape these characters while writing them to xml?

Thanks


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>