文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Create XML with LoadXml(string) i..

Create XML with LoadXml(string) i..

时间:2010-10-11  来源:yaoxin2010

using System;
using System.Xml;

public partial class create_xml_string : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
    {
      string xmlString = "<?xml version='1.0' encoding='UTF-8'?>";
      xmlString += "<products>";
        xmlString += "<product id='p3'>";
          xmlString += "<name>Alpha</name>";
          xmlString += "<price>1200</price>";
          xmlString += "<stock>19</stock>";
          xmlString += "<country>Germany</country>";
        xmlString += "</product>";
      xmlString += "</products>";

      XmlDocument doc = new XmlDocument();
      doc.LoadXml(xmlString);
      doc.Save(Server.MapPath("products-string.xml"));

      Response.Redirect("products-string.xml"); // load file in browser
    }
}

相关阅读 更多 +
排行榜 更多 +
进击小巨人最新版

进击小巨人最新版

冒险解谜 下载
吞就完了手机版

吞就完了手机版

冒险解谜 下载
坦克玩具城

坦克玩具城

冒险解谜 下载