Method body
using System;
using System.Xml;
using System.Configuration;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace Xmlsize
{
public struct Strrestric
{
public string Msgpage;
public string msgprompt;
public int size;
}
public class Xmlrestrict
{
public static strrestric res;
public xmlrestrict ()
{
res.msgpage= "";
res.msgprompt= "";
res.size=0;
}
public static Object Restrict (String xmlpathname,string nodeid,strrestric res)
{
int nodenum=1;
String Path= "";
path =configurationsettings.appsettings.get (xmlpathname). ToString ();
path+= "Restrict.xml";
Try
{
XmlDocument xmldoc=new XmlDocument ();
xmldoc.load (path);
xmlnodelist nodelist=xmldoc.selectsinglenode ("Tree"). ChildNodes;
foreach (XmlNode xn in nodelist)
{
XmlElement xe= (xmlelement) xn;
if (XE. name== "Node")
{
XmlNodeList Nls=xe. ChildNodes;
foreach (XmlNode xn1 in NLS)
{
XmlElement xe2= (XmlElement) xn1;
if (xe2. name== "PageID")
{
if (xe2. Innertext==nodeid)
{
XmlNode xnchild= (XmlNode) Xe2;
XmlNode child=xnchild.parentnode.childnodes[nodenum+1];
XmlElement xechild= (XmlElement) child;
string Id=xechild.getattribute ("value");
int Pid=int. Parse (ID);
Res.msgpage=child. Innertext.tostring ();
res.msgprompt=xnchild.parentnode.childnodes[nodenum+2]. Innertext.tostring ();
Res.size=pid;
return res;
}
break;
}
}
}
}
}
Catch
{}
return null;
}