我如何保存HTML页面的XML文件? [英] How do I store html page in a xml file?

查看:129
本文介绍了我如何保存HTML页面的XML文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写在C#作为,我想用它来发送电子邮件控制台应用程序的小应用程序。我打算存储在XML文件中的电子邮件和其他信息,该消息将需要像一个主题一起。不过似乎有一个问题,因为XML文件犯规像< / BR> 字符。

I have a small application written in c# as a console app that I want to use to send an email. I was planning on storing the email inside an xml file along with other information that the message will need like a subject. However there seems to be a problem because the XML file doesnt like </br> characters.

我想知道我应该以每行存储的HTML电子邮件我只是要keeo身体HTML在一个单独的HTML文件,然后读入一个StreamReader做?反对

Im wondering what I should do in order to store a html email do I just have to keeo the body html in a seperate html file and then read each line into a StreamReader object?

推荐答案

最简单的方法是将存储在一个的CDATA部分

The easiest way would be to store the HTML content in a CDATA section:

<mail>
  <subject>Test</subject>
  <body>
    <![CDATA[
      <html>
        ...
      </html>
     ]]>
  </body>
</mail>

这篇关于我如何保存HTML页面的XML文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆