Is there a way i can preserve\r\n on XElement.Load().
TextReader reader = new StringReader(rawInputString);//rawInputString is just text in html format
XElement root = XElement.Load(reader);
Edit :
string rawInputString = "<Html><Body><p></p> \r\n <p></p>\r\n \r\n \r\n </Body></Html>";
After XELement.Load the output i want is the same when i do root.ToString() :
"<Html><Body><p></p> \r\n <p></p>\r\n \r\n \r\n </Body></Html>"
For Now it just cleans/removes up the \r\n
This should do the trick:
Check this article for more information: Preserving White Space while Loading or Parsing XML
In addition, callling the
XElement.ToString()method will cause theXElementto apply its own formatting. In order to prevent that, you must callXElement.ToString(SaveOptions.DisableFormatting)