zoukankan      html  css  js  c++  java
  • c#操作XML

    using System.Xml;
    
     XmlDocument xdTree = new XmlDocument();
            xdTree.Load(Server.MapPath("~/TreeView.xml"));//读取XML文件
            XmlElement xmlNew=xdTree.CreateElement("siteMapNode");//创建节点
            xmlNew.SetAttribute("title",cate.Name);
            xmlNew.SetAttribute("url","BookList.aspx?typeid=1");//+cate.Id.ToString());
            xmlNew.SetAttribute("description","");        
            xdTree.SelectSingleNode("siteMapNode").AppendChild(xmlNew);//将节点值添加到节点
            xdTree.Save(Server.MapPath("~/TreeView.xml"));//保存XML文件
     
     <?xml version="1.0" encoding="utf-8" ?>
    - <siteRoot Id="root" url="" title="管理员控制面板" description="">
    - <siteMapNode url="" title="用户管理" description="">
      <siteMapNode url="~AdminListAllUsers.aspx" title="管理用户" description="" />
      <siteMapNode url="~AdminUserStatue.aspx" title="状态管理" description="" />
      <siteMapNode url="~AdminListAllUsers.aspx" title="用户列表" description="" />
      </siteMapNode>
    - <siteMapNode url="" title="图书分类管理" description="">
      <siteMapNode url="~AdminAddBooksCatagory.aspx" title="添加图书分类" description="" />
      <siteMapNode url="~AdminListBooksByCategory.aspx" title="为书籍分类" description="" />
      <siteMapNode url="~AdminListOfBooks.aspx" title="书籍列表" description="" />
      </siteMapNode>
    - <siteMapNode url="" title="定单管理" description="">
      <siteMapNode url="~AdminCheckOrders.aspx" title="审核定单" description="" />
      </siteMapNode>
      <siteMapNode url="~AdminLoginOut.aspx" title="退出" description="管理员退出" />
      </siteRoot>
  • 相关阅读:
    Delphi 获取不重复随机数《LceMeaning》
    轻松一下
    MS SQL字段类型详解《转》
    Go语言优势与劣势
    go语言特点
    初始go语言
    django 短链接改成长连接
    extjs [1]
    Supervisor安装与配置
    InfluxDB命令使用
  • 原文地址:https://www.cnblogs.com/qigege/p/4750042.html
Copyright © 2011-2022 走看看