zoukankan      html  css  js  c++  java
  • C# 创建XML文件

     1        private void CreateXMLFile(string pathAndFileName)
     2         {
     3             XmlDocument doc = new XmlDocument();
     4             XmlElement rootElementUser,subElementUserID,subElementXMID;
     5 
     6             XmlNode node = doc.CreateXmlDeclaration("1.0","utf-8","no");
     7             doc.AppendChild(node);
     8 
     9             rootElementUser = doc.CreateElement("user");
    10             doc.AppendChild(rootElementUser);
    11 
    12             subElementUserID = doc.CreateElement("userID");
    13             XmlText userID = doc.CreateTextNode(XiangMuGG.Userintid.ToString());
    14             subElementUserID.AppendChild(userID);
    15             rootElementUser.AppendChild(subElementUserID);
    16 
    17             subElementXMID = doc.CreateElement("xmID");
    18             XmlText xmID = doc.CreateTextNode(XiangMuGG.xmid.ToString());
    19             subElementXMID.AppendChild(xmID);
    20             rootElementUser.AppendChild(subElementXMID);
    21 
    22             doc.Save(pathAndFileName);
    23         }

  • 相关阅读:
    expdp使用
    sed命令(二)
    linux的sed命令(一)
    weblogic找不到数据源
    windows 常用操作
    Spring in action (1)
    Eclipse使用
    maven
    Maven-01 安装maven
    Java开发环境搭建
  • 原文地址:https://www.cnblogs.com/xiaocaibaodao/p/3144406.html
Copyright © 2011-2022 走看看