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>
  • 相关阅读:
    赵炯博士《Linux内核完全注释》
    0.11内核rd_load@ramdisk.c中memcpy函数好像有bug
    Can't find kernel text map area from kcore
    Could not allocate 40960 bytes percpu data
    镜像
    H3C S6800交换机 BCM shell命令
    Bean的作用域
    Bean之间的关系
    Bean的自动装配
    Java8 Hash改进/内存改进
  • 原文地址:https://www.cnblogs.com/qigege/p/4750042.html
Copyright © 2011-2022 走看看