How to set break line or special symbol in XML?

  • Thread starter Thread starter Le Thien Hoang
  • Start date Start date
L

Le Thien Hoang

Guest
Currently, I got a problem with text in XML.

private readonly string htmlTemplate = "<![CDATA[{0}]]>";

string abc = string.Format(htmlTemplate,classsificationDetailItem.Description.Replace(@"•", string.Empty)
.Replace(@"<", "&lt;")
.Replace(@">", "&gt")
.Replace(@"≤", "&le;")
.Replace(@"≤", "&le;")
.Replace(@"≥", "&ge;"))





string docText = null;
using (StreamReader sr = new StreamReader(wordDoc.MainDocumentPart.GetStream()))
{
docText = sr.ReadToEnd();
}


docText = docText.Replace("special symbol", abc);

using (StreamWriter sw = new StreamWriter(wordDoc.MainDocumentPart.GetStream(FileMode.Create)))
{
sw.Write(docText);
}





In class, I parse a text to XML and download it but it's incorrect. The text still display as the example is bellow

3 &lt; 4 &le;


.....";

I want to break a line and set special symbols to string and parse them to XML.

Continue reading...
 
Back
Top