I am creating an XML File where a tag’s Innertext is \r\n
It is creating fine. But when i read these xml files in code-behind \r\n gets read as \n\n
I am reading it through XMLTextReader.
What could be the reason for this and how to read it like it was provided?
You need to encode such characters in order for them to be preserved.
One approach is to replace the characters with the respective character reference:
\nto \rto Another one would be to enclose sections that need to preserve whitespace in
<![CDATA[]]>sections.