Backup/CRD.Common/WriteXML.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//xxxxxxxxxxx
using System;
using System.Collections.Generic;

using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Data;

namespace CRD.Common
{
    public class WriteXML
    {
        public static void CreateXMLDocument(string XMLDocumentName, string NodeName, string NodeText)
        {
            XmlDocument xmldoc;
            XmlNode xmlnode;
            XmlElement xmlelem;
            XmlElement MiscList;

            XmlText xmltext;
            if (System.IO.File.Exists(Application.StartupPath + "\\" + XMLDocumentName + ".xml"))
            {
                xmldoc = new XmlDocument();
                xmldoc.Load(Application.StartupPath + "\\" + XMLDocumentName + ".xml");
                MiscList = xmldoc.CreateElement(NodeName);
                MiscList = xmldoc.CreateElement("", NodeName, "");
                xmltext = xmldoc.CreateTextNode(NodeText);
                MiscList.AppendChild(xmltext);
                xmldoc.ChildNodes.Item(1).AppendChild(MiscList);
            }
            else
            {
                xmldoc = new XmlDocument();
                //加入XML的声明段落
                xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, "", "");
                xmldoc.AppendChild(xmlnode);
                //加入一个根元素
                xmlelem = xmldoc.CreateElement("", "NodeList", "");
                //  xmltext = xmldoc.CreateTextNode("heyu5220");
                //  xmlelem.AppendChild(xmltext);
                xmldoc.AppendChild(xmlelem);
                //加入另外一个元素
                MiscList = xmldoc.CreateElement(NodeName);
                MiscList = xmldoc.CreateElement("", NodeName, "");
                xmltext = xmldoc.CreateTextNode(NodeText);
                MiscList.AppendChild(xmltext);
                xmldoc.ChildNodes.Item(1).AppendChild(MiscList);
            }
            //保存创建好的XML文档
            try
            {
                xmldoc.Save(Application.StartupPath + "\\" + XMLDocumentName + ".xml");
            }
            catch (Exception e)
            {
                //显示错误信息
                Console.WriteLine(e.Message);
            }
            Console.ReadLine();
后面还有 173 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。