XML文檔格式如下
- <?xml version="1.0" encoding="utf-8" ?>
- <menu>
- <submenu id="1" text="校區基本信息">
- <item text="校區管理" href="SchoolBaseSet/SchoolManagement/SchoolInformation.aspx" mce_href="SchoolBaseSet/SchoolManagement/SchoolInformation.aspx" roles="超級管理員,系統管理員,院校長"></item>
- <item text="班級管理" href="SchoolBaseSet/ClassManagement/ClassInformation.aspx" mce_href="SchoolBaseSet/ClassManagement/ClassInformation.aspx" roles="超級管理員,系統管理員,班主任,院校長,教學主管,教學主任,校區考試專員" ></item>
- <item text="學生信息管理" href="SchoolBaseSet/StudentInformation/StudentInformation.aspx" mce_href="SchoolBaseSet/StudentInformation/StudentInformation.aspx" roles="超級管理員,系統管理員,院校長,班主任,教學主管,教學主任" ></item>
- <item text="用戶信息管理" href="SchoolBaseSet/UserManagement/UserInformation.aspx" mce_href="SchoolBaseSet/UserManagement/UserInformation.aspx" roles="超級管理員,系統管理員,院校長,教學主管,教學主任"></item>
- <item text="教師審批管理" href="SchoolBaseSet/TeacherPass/TeacherPass.aspx" mce_href="SchoolBaseSet/TeacherPass/TeacherPass.aspx" roles="教學主管,教學主任,校區考試專員"></item>
- <item text="切換教師角色" href="SchoolBaseSet/TeacherPass/RolesChange.aspx" mce_href="SchoolBaseSet/TeacherPass/RolesChange.aspx" roles="校區考試專員"></item>
- </submenu>
- <submenu id="2" text="學生成績管理">
- <item text="成績綜合管理" href="StudentGradeManagement/StudentGradedescirption/StudentGradeAll.aspx" mce_href="StudentGradeManagement/StudentGradedescirption/StudentGradeAll.aspx" roles="超級管理員,系統管理員,院校長,班主任,教學主管,教學主任" ></item>
- <item text="學生成績管理" href="StudentGradeManagement/StudentGradedescirption/StudentInformation.aspx" mce_href="StudentGradeManagement/StudentGradedescirption/StudentInformation.aspx" roles="超級管理員,系統管理員,院校長,班主任,教學主管,教學主任" ></item>
- </submenu>
- <submenu id="3" text="數據字典設置">
- <item text="專業管理" href="DataDictionary/Specialty/Specialties.aspx" mce_href="DataDictionary/Specialty/Specialties.aspx" roles="超級管理員,系統管理員" ></item>
- <item text="課程管理" href="DataDictionary/Course/Courses.aspx" mce_href="DataDictionary/Course/Courses.aspx" roles="超級管理員,系統管理員" ></item>
- <item text="專業課程管理" href="DataDictionary/CourseInSpecialty/CouserInSpecialty.aspx" mce_href="DataDictionary/CourseInSpecialty/CouserInSpecialty.aspx" roles="超級管理員,系統管理員" ></item>
- <item text="角色管理" href="DataDictionary/Rolse/Roles.aspx" mce_href="DataDictionary/Rolse/Roles.aspx" roles="超級管理員"></item>
- <item text="管理員管理" href="DataDictionary/AdminUser/AdministratorUser.aspx" mce_href="DataDictionary/AdminUser/AdministratorUser.aspx" roles="超級管理員" ></item>
- <item text="Logo圖標管理" href="DataDictionary/Logo/EditLogo.aspx" mce_href="DataDictionary/Logo/EditLogo.aspx" roles="超級管理員,系統管理員,教學主管,教學主任" ></item>
- <item text="學號長度設置" href="DataDictionary/StudentCodeSet/StudentCodeLenghtInf.aspx" mce_href="DataDictionary/StudentCodeSet/StudentCodeLenghtInf.aspx" roles="超級管理員,系統管理員" ></item>
- <item text="恢復設置管理" href="DataDictionary/RemoveSchool/RemoveAllSchool.aspx" mce_href="DataDictionary/RemoveSchool/RemoveAllSchool.aspx" roles="超級管理員" ></item>
- </submenu>
- <submenu id="4" text="考試操作管理">
- <item text="考試類型管理" href="ExamManagement/ExamType/ExamTypeInformation.aspx" mce_href="ExamManagement/ExamType/ExamTypeInformation.aspx" roles="超級管理員,系統管理員" ></item>
- <item text="試卷模板管理" href="ExamManagement/ExamTemplate/ExamTemplateInformation.aspx" mce_href="ExamManagement/ExamTemplate/ExamTemplateInformation.aspx" roles="超級管理員,系統管理員" ></item>
- <item text="試題類型管理" href="ExamManagement/ExaminationType/ExaminationInformation.aspx" mce_href="ExamManagement/ExaminationType/ExaminationInformation.aspx" roles="超級管理員,系統管理員" ></item>
- <item text="試題題目管理" href="ExamManagement/ExamQuestion/QuestionInformation.aspx" mce_href="ExamManagement/ExamQuestion/QuestionInformation.aspx" roles="超級管理員,系統管理員" ></item>
- <item text="考試申請管理" href="ExamManagement/ExamApplication/ExamApplicationInformation.aspx" mce_href="ExamManagement/ExamApplication/ExamApplicationInformation.aspx" roles="超級管理員,系統管理員" ></item>
- <item text="試卷下載管理" href="ExamManagement/ExamDownLoad/ExamDownLoadInformation.aspx" mce_href="ExamManagement/ExamDownLoad/ExamDownLoadInformation.aspx" roles="超級管理員,系統管理員" ></item>
- <item text="試卷刪除管理" href="ExamManagement/ExamPaperDelete/ExamPaperClear.aspx" mce_href="ExamManagement/ExamPaperDelete/ExamPaperClear.aspx" roles="超級管理員,系統管理員" ></item>
- </submenu>
- <submenu id="5" text="報表信息管理">
- <item text="緩考補考報表" href="ReportInformation/StudentExamState/StudentExamState.aspx" mce_href="ReportInformation/StudentExamState/StudentExamState.aspx" roles="超級管理員,系統管理員,院校長,班主任,教學主管,教學主任,校區考試專員" ></item>
- <item text="校區考試報表" href="ReportInformation/ExamGrade/ExamGradeReport.aspx" mce_href="ReportInformation/ExamGrade/ExamGradeReport.aspx" roles="超級管理員,系統管理員,院校長,教學主管,教學主任,校區考試專員" ></item>
- <item text="班級課程報表" href="ReportInformation/StudentExamByClass/StudentExamReport.aspx" mce_href="ReportInformation/StudentExamByClass/StudentExamReport.aspx" roles="超級管理員,系統管理員,院校長,班主任,教學主管,教學主任,校區考試專員" ></item>
- </submenu>
- <submenu id="6" text="日誌操作管理">
- <item text="登陸日誌管理" href="LoginManagement/LogLogins.aspx" mce_href="LoginManagement/LogLogins.aspx" roles="超級管理員" ></item>
- <item text="操作日誌管理" href="LoginManagement/LogOpeations.aspx" mce_href="LoginManagement/LogOpeations.aspx" roles="超級管理員" ></item>
- <item text="日誌導出" href="LoginManagement/ErportLog.aspx" mce_href="LoginManagement/ErportLog.aspx" roles="超級管理員" >
- </item>
- </submenu>
- <submenu id="7" text="個人信息管理">
- <item text="個人資料修改" href="PersonalManagement/PersonalManagement.aspx" mce_href="PersonalManagement/PersonalManagement.aspx" roles="超級管理員,系統管理員,院校長,班主任,教學主管,教學主任,校區考試專員" ></item>
- </submenu>
- </menu>
defatult.aspx.cs文件代碼
- XmlDocument x = new XmlDocument();//實例化一個XML文檔
- protected void Page_Load(object sender, EventArgs e)
- {
- XMLopertator();
- }
- /// <summary>
- /// 循環讀取XML裏的內容
- /// </summary>
- public void XMLopertator()
- {
- XMLLoad();
- XmlNodeList xnl=x.ChildNodes;
- foreach (XmlNode xn in xnl)
- {
- XmlNodeList xnl1 = xn.ChildNodes;
- foreach (XmlNode xn1 in xnl1)
- {
- XmlNodeList xnl2 = xn1.ChildNodes;
- foreach (XmlNode xn2 in xnl2)
- {
- Response.Write(xn2.Attributes["text"].Value+"<br/>");
- }
- }
- }
- }
- /// <summary>
- /// 加載XML文檔
- /// </summary>
- public void XMLLoad()
- {
- x.Load(Server.MapPath("~/Left.xml"));
- }
轉載自:點擊打開鏈接
做起來很簡單 的