开发者

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

开发者 https://www.devze.com 2023-03-15 00:56 出处:网络
There is a method wich takes the *.xml template made with Excel formatting and insert some text into it.

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 tur开发者_运维百科ns 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?


Use CDATA

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号