The code inside the CS file
Copy Code code as follows:
Using System;
Using System.Collections;
Using System.Configuration;
Using System.Data;
Using System.Linq;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.HtmlControls;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Xml;
Using System.IO;
Namespace Root
{
public partial class WebUserControl1:System.Web.UI.UserControl
{
XmlDocument x = new XmlDocument ();
protected void Page_Load (object sender, EventArgs e)
{
if (! IsPostBack)
{
Xmloperator ();
}
}
<summary>
XML operations
</summary>
private void Xmloperator ()
{
Xmlload ();
String str = "<table><tr><td>";
foreach (XmlNode xn in x.childnodes)
{
foreach (XmlNode xn1 in xn. ChildNodes)
{
str = xn1. attributes["Text"]. Value;
STR + + "</td></tr>";
foreach (XmlNode xn2 in Xn1. ChildNodes)
{
STR + + "<tr><td>";
str = xn2. attributes["Text"]. Value;
STR + + "</td></tr>";
}
}
}
STR + + "</table>";
Response.Write (str);
}
<summary>
Load XML document
</summary>
private void Xmlload ()
{
X.load (Server.MapPath ("~/left.xml"));
}
<summary>
Reading XML content
</summary>
<param name= "Path" ></param>
<returns></returns>
Private DataSet ReadXml (string path)
{
DataSet ds = new DataSet ();
FileStream fs = null;
StreamReader reader = null;
Try
{
FS = new FileStream (path, FileMode.Open, FileAccess.Read);
reader = new StreamReader (FS, System.Text.Encoding.UTF8);
Ds. READXML (reader);
return DS;
}
Finally
{
Fs. Close ();
Reader. Close ();
}
}
}
}
XML data
Copy Code code as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<menu>
<submenu id= "1" text= "Campus basic Information" >
<item text= "Campus Management" href= "schoolbaseset/schoolmanagement/schoolinformation.aspx" href= "SchoolBaseSet/" Schoolmanagement/schoolinformation.aspx "roles=" Super Administrator, System Administrator, President of the Academy "></item>
<item text= "class management" href= "schoolbaseset/classmanagement/classinformation.aspx" href= "schoolbaseset/" Classmanagement/classinformation.aspx "roles=" Super Administrator, System Administrator, headteacher, headmaster, teaching supervisor, teaching Director, School District examination Specialist "></item>
<item text= "Student Information Management" href= "schoolbaseset/studentinformation/studentinformation.aspx" href= "SchoolBaseSet/" Studentinformation/studentinformation.aspx "roles=" Super Administrator, System Administrator, headmaster, head teacher, teaching supervisor, teaching Director "></item>
<item text= "User information management" href= "schoolbaseset/usermanagement/userinformation.aspx" href= "schoolbaseset/" Usermanagement/userinformation.aspx "roles=" Super Administrator, System Administrator, headmaster, teaching director, teaching officer ></item>
<item text= "Teacher approval management" href= "schoolbaseset/teacherpass/teacherpass.aspx" href= "schoolbaseset/teacherpass/" Teacherpass.aspx "roles=" teaching supervisor, teaching Director, District Examination Specialist "></item>
<item text= "switch teacher role" href= "schoolbaseset/teacherpass/roleschange.aspx" href= "schoolbaseset/teacherpass/" Roleschange.aspx "roles=" Campus examination specialist ></item>
</submenu>
<submenu id= "2" text= "Student performance Management" >
<item text= "Achievement Integrated Management" href= "studentgrademanagement/studentgradedescirption/studentgradeall.aspx" href= " Studentgrademanagement/studentgradedescirption/studentgradeall.aspx "roles=" Super Administrator, System Administrator, headmaster, head teacher, teaching supervisor, teaching Director "> </item>
<item text= "Student performance management" href= "studentgrademanagement/studentgradedescirption/studentinformation.aspx" href= " Studentgrademanagement/studentgradedescirption/studentinformation.aspx "roles=" Super Administrator, System Administrator, headmaster, head teacher, teaching supervisor, teaching Director " ></item>
</submenu>
<submenu id= "3" text= "Data Dictionary Settings" >
<item text= "Professional Management" href= "datadictionary/specialty/specialties.aspx" href= "datadictionary/specialty/" Specialties.aspx "roles=" Super Administrator, System administrator ></item>
<item text= "Curriculum management" href= "datadictionary/course/courses.aspx" href= "datadictionary/course/courses.aspx" roles= " Super Admin, System administrator ></item>
<item text= "Professional curriculum Management" href= "datadictionary/courseinspecialty/couserinspecialty.aspx" href= "DataDictionary/" Courseinspecialty/couserinspecialty.aspx "roles=" Super Administrator, System administrator ></item>
<item text= "Role Management" href= "datadictionary/rolse/roles.aspx" href= "datadictionary/rolse/roles.aspx" roles= "Super Administrator" ></item>
<item text= "Admin admin" href= datadictionary/adminuser/administratoruser.aspx "href=" datadictionary/adminuser/ Administratoruser.aspx "roles= Super admin" ></item>
<item text= "Logo icon Management" href= "datadictionary/logo/editlogo.aspx" href= "datadictionary/logo/editlogo.aspx" roles= " Super Administrator, System Administrator, teaching supervisor, teaching Director "></item>
<item text= "School number length set" href= "Datadictionary/studentcodeset/studentcodelenghtinf.aspx" href= "DataDictionary/ Studentcodeset/studentcodelenghtinf.aspx "roles=" Super Administrator, System administrator ></item>
<item text= "Restore Settings Management" href= "datadictionary/removeschool/removeallschool.aspx" href= "datadictionary/removeschool/" Removeallschool.aspx "roles= Super admin" ></item>
</submenu>
<submenu id= "4" text= "Exam operation Management" >
<item text= "Exam type Management" href= "exammanagement/examtype/examtypeinformation.aspx" href= "exammanagement/examtype/" Examtypeinformation.aspx "roles=" Super Administrator, System administrator ></item>
<item text= "test paper Template Management" href= "exammanagement/examtemplate/examtemplateinformation.aspx" href= "ExamManagement/" Examtemplate/examtemplateinformation.aspx "roles=" Super Administrator, System administrator ></item>
<item text= "question type management" href= "exammanagement/examinationtype/examinationinformation.aspx" href= "ExamManagement/" Examinationtype/examinationinformation.aspx "roles=" Super Administrator, System administrator ></item>
<item text= "question management" href= "exammanagement/examquestion/questioninformation.aspx" href= "ExamManagement/" Examquestion/questioninformation.aspx "roles=" Super Administrator, System administrator ></item>
<item text= "Examination Application Management" href= "exammanagement/examapplication/examapplicationinformation.aspx" href= "ExamManagement" /examapplication/examapplicationinformation.aspx "roles=" Super Administrator, System administrator ></item>
<item text= "test paper Download Management" href= "exammanagement/examdownload/examdownloadinformation.aspx" href= "ExamManagement/" Examdownload/examdownloadinformation.aspx "roles=" Super Administrator, System administrator ></item>
<item text= "Quiz removal Management" href= "exammanagement/exampaperdelete/exampaperclear.aspx" href= "exammanagement/" Exampaperdelete/exampaperclear.aspx "roles=" Super Administrator, System administrator ></item>
</submenu>
<submenu id= "5" text= "Report Information Management" >
"Href=" reportinformation/studentexamstate/studentexamstate.aspx "href=" ReportInformation/of "<item text=" exam report Studentexamstate/studentexamstate.aspx "roles=" Super Administrator, System Administrator, headmaster, head teacher, teaching director, teaching Officer, District examination Specialist "></item>
<item text= "Campus Examination Report" href= "reportinformation/examgrade/examgradereport.aspx" href= "reportinformation/examgrade/" Examgradereport.aspx "roles=" Super Administrator, System Administrator, Dean, teaching Director, School District examination Specialist "></item>
<item text= "class curriculum Report" href= "reportinformation/studentexambyclass/studentexamreport.aspx" href= "ReportInformation" /studentexambyclass/studentexamreport.aspx "roles=" Super Administrator, System Administrator, headmaster, head teacher, teaching director, teaching Officer, District examination Specialist "></item>
</submenu>
<submenu id= "6" text= "Log Operations Management" >
<item text= "Login log Admin" href= "loginmanagement/loglogins.aspx" href= "loginmanagement/loglogins.aspx" roles= "Super admin" ></item>
<item text= "Operation Log Management" href= "loginmanagement/logopeations.aspx" href= "loginmanagement/logopeations.aspx" roles= " Super admin "></item>
<item text= "Log Export" href= "loginmanagement/erportlog.aspx" href= "loginmanagement/erportlog.aspx" roles= "Super admin" >
</item>
</submenu>
<submenu id= "7" text= "Personal information Management" >
<item text= "Personal data modification" href= "personalmanagement/personalmanagement.aspx" href= "personalmanagement/" Personalmanagement.aspx "roles=" Super Administrator, System Administrator, headmaster, head teacher, teaching director, teaching Officer, District examination Specialist "></item>
</submenu>
</menu>
From the simple code above you can see that if you have permission, you can use the roles attribute of the node to determine whether the current login account role name is eligible and then judge the output so you can directly manipulate the XML data without considering anything else.