zoukankan      html  css  js  c++  java
  • CreateXMl

    //设置xml文件存放的目录
    string path = Server.MapPath("App_Data/new.xml");
    //使用LINQ创建xml文件的内容
    XDocument doc = new XDocument(
                     new XDeclaration("1.0", "utf-8", "yes"),
                          new XElement("People",
                                              new XElement("Person",
                                              new XAttribute("IDCard", "22030219771012***"),
                                              new XElement("Name", "张三"),
                                              new XElement("Sex", "男"),
                                              new XElement("Old", 20)
    )
    )
    );
    //保存为new.xml文件
    doc.Save(path);
    //在页面上输出xml文件内容
    Response.Write(doc);
    //设置网页显示的类型为XML文件
    Response.ContentType = "text/xml";
    Response.End();

  • 相关阅读:
    缓冲区
    4.9
    JDBC连接
    3.31
    BizTalk框架概述
    不通过SPS对象模型更改文档扩展字段的方法
    asdfasdf
    设计模式介绍
    Multiple Checkbox Items In A DataGrid Introduction
    Factory Method
  • 原文地址:https://www.cnblogs.com/Yellowshorts/p/2867606.html
Copyright © 2011-2022 走看看