binariti
binariti

Reputation: 93

How make xml to not auto replace ampersand characters in ASP.NET

There is a method wich takes the *.xml template made with Excel formatting and insert some text into it. When I'm inserting text with \r\n symbols, Excel ignores the brakes and write all in one line. It turns out, that Excel needs the "
" in xml instead of "\r\n". So i'm trying to replace

NewText = NewText.Replace("\r\n", "
").Replace("\n", "
");
node["Data"].InnerText = NewText;

But then I see, that all the "
" are implicitly changed with "&amp ;#10;" by XmlDocument. What should I do to save xml with "
" in it?

Upvotes: 0

Views: 884

Answers (1)

JeremyWeir
JeremyWeir

Reputation: 24368

Use CDATA

http://www.w3schools.com/xml/xml_cdata.asp

Upvotes: 2

Related Questions