本文整理汇总了C#中Discuz.Common.Xml.XmlDocumentExtender类的典型用法代码示例。如果您正苦于以下问题:C# XmlDocumentExtender类的具体用法?C# XmlDocumentExtender怎么用?C# XmlDocumentExtender使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlDocumentExtender类属于Discuz.Common.Xml命名空间,在下文中一共展示了XmlDocumentExtender类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindDataGrid
private void BindDataGrid()
{
DataGrid1.TableHeaderName = pagename + " 子菜单项管理";
XmlDocumentExtender doc = new XmlDocumentExtender();
doc.Load(configPath);
string submenuid = DNTRequest.GetString("submenuid");
XmlNodeList submenusitem = doc.SelectNodes("/dataset/submain");
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("id"));
dt.Columns.Add(new DataColumn("menutitle"));
dt.Columns.Add(new DataColumn("link"));
int i = 0;
foreach (XmlNode menuitem in submenusitem)
{
if(menuitem["menuparentid"].InnerText == submenuid)
{
DataRow dr = dt.NewRow();
dr["id"] = i.ToString();
dr["menutitle"] = menuitem["menutitle"].InnerText;
dr["link"] = menuitem["link"].InnerText;
dt.Rows.Add(dr);
}
i++;
}
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
}
示例2: BindEditData
private void BindEditData(string tid)
{
#region 装载主题编辑
panel1.Visible = true;
XmlDocumentExtender doc = new XmlDocumentExtender();
if (!File.Exists(configPath))
return;
doc.Load(configPath);
string topicPath = "/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist/Topic";
if (fid != "")
topicPath = "/Aggregationinfo/Forum/Topiclist/Topic";
XmlNodeList topiclistNode = doc.SelectNodes(topicPath);
XmlNodeInnerTextVisitor topicvisitor = new XmlNodeInnerTextVisitor();
foreach (XmlNode topic in topiclistNode)
{
topicvisitor.SetNode(topic);
if (topicvisitor["topicid"] == tid)
{
topicid.Value = topicvisitor["topicid"];
title.Text = topicvisitor["title"];
poster.Text = topicvisitor["poster"];
postdatetime.Text = topicvisitor["postdatetime"];
shortdescription.Text = topicvisitor["shortdescription"];
fulldescription.Value = topicvisitor["fulldescription"];
}
}
#endregion
}
示例3: LoadWebSiteConfig
/// <summary>
/// 装载WebSite信息
/// </summary>
private void LoadWebSiteConfig()
{
#region 装载主题信息
XmlDocumentExtender doc = new XmlDocumentExtender();
doc.Load(configPath);
XmlNodeList topiclistNode = doc.SelectNodes("/Aggregationinfo/Data/Hottopiclist/Topic");
XmlNodeList website_spacelistnode = doc.SelectNodes("/Aggregationinfo/Forum/Hottopiclist/Topic");
XmlNodeInnerTextVisitor topicvisitor = new XmlNodeInnerTextVisitor();
XmlNodeInnerTextVisitor pagetopicvisitor = new XmlNodeInnerTextVisitor();
forumlist.Text = "";
int i = 0;
foreach (XmlNode topic in topiclistNode)
{
topicvisitor.SetNode(topic);
bool isCheck = false;
foreach (XmlNode index in website_spacelistnode)
{
pagetopicvisitor.SetNode(index);
if (topicvisitor["tid"].ToString() == pagetopicvisitor["tid"].ToString())
{
isCheck = true;
break;
}
}
forumlist.Text += "<div class='mo' id='m" + i + "' flag='f" + i + "'><h1><input type='checkbox' name='tid' " + (isCheck ? "checked" : "") + " value='" + topicvisitor["tid"] + "'>" + topicvisitor["title"] + "</h1></div>\n";
i++;
}
#endregion
}
示例4: NewMainMenu
/// <summary>
/// 增加主菜单
/// </summary>
/// <param name="title">主菜单标题</param>
/// <param name="defaulturl">主菜单默认展开的页面</param>
/// <returns>新主菜单项ID</returns>
public static int NewMainMenu(string title, string defaulturl)
{
XmlDocumentExtender doc = new XmlDocumentExtender();
doc.Load(configPath);
XmlNodeList mainmenus = doc.SelectNodes("/dataset/toptabmenu");
int newMenuId = mainmenus.Count + 1;
XmlElement newMainMenuItem = doc.CreateElement("toptabmenu");
XmlElement node = doc.CreateElement("id");
node.InnerText = newMenuId.ToString();
newMainMenuItem.AppendChild(node);
node = doc.CreateElement("title");
node.InnerText = title;
newMainMenuItem.AppendChild(node);
node = doc.CreateElement("mainmenulist");
node.InnerText = "";
newMainMenuItem.AppendChild(node);
node = doc.CreateElement("mainmenuidlist");
node.InnerText = "";
newMainMenuItem.AppendChild(node);
node = doc.CreateElement("defaulturl");
node.InnerText = defaulturl;
newMainMenuItem.AppendChild(node);
node = doc.CreateElement("system");
node.InnerText = "0";
newMainMenuItem.AppendChild(node);
doc.SelectSingleNode("/dataset").AppendChild(newMainMenuItem);
doc.Save(configPath);
return newMenuId;
}
示例5: GetParm
/// <summary>
/// 获取当前页面的参数
/// </summary>
/// <param name="doc"></param>
/// <param name="menuparentid"></param>
/// <returns></returns>
public string[] GetParm(XmlDocumentExtender doc, string menuparentid)
{
string[] parm = new string[3];
XmlNodeList mainmenus = doc.SelectNodes("/dataset/mainmenu");
XmlNodeInnerTextVisitor menuvisitor = new XmlNodeInnerTextVisitor();
foreach (XmlNode mainmenu in mainmenus)
{
menuvisitor.SetNode(mainmenu);
if (menuvisitor["menuid"] == menuparentid)
{
parm[0] = menuvisitor["id"];
break;
}
}
XmlNodeList toptabmenus = doc.SelectNodes("/dataset/toptabmenu");
foreach (XmlNode toptabmenu in toptabmenus)
{
menuvisitor.SetNode(toptabmenu);
if (("," + menuvisitor["mainmenulist"] + ",").IndexOf("," + parm[0] + ",") != -1)
{
parm[1] = menuvisitor["id"];
parm[2] = menuvisitor["mainmenulist"];
break;
}
}
return parm;
}
示例6: Uri
/*private void SaveManagerBody()
{
string url = Context.Request.Url.ToString().ToLower().Substring(0, Context.Request.Url.ToString().ToLower().IndexOf("rapidset")) + "framepage/managerbody.aspx";
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(new Uri(url));
req.Method = "GET";
WebResponse wr = req.GetResponse();
StreamReader sr = new StreamReader(wr.GetResponseStream(), System.Text.Encoding.GetEncoding("gb2312"));
string html = sr.ReadToEnd();
FileStream fs = new FileStream(Utils.GetMapPath("../framepage/managerbody.htm"), FileMode.Create);
byte[] bt = System.Text.Encoding.UTF8.GetBytes(html);
fs.Write(bt, 0, bt.Length);
fs.Close();
}*/
private void BindDataGrid()
{
DataGrid1.TableHeaderName = "菜单管理";
XmlDocumentExtender doc = new XmlDocumentExtender();
doc.Load(configPath);
XmlNodeList mainmenus = doc.SelectNodes("/dataset/toptabmenu");
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("id"));
dt.Columns.Add(new DataColumn("title"));
dt.Columns.Add(new DataColumn("defaulturl"));
dt.Columns.Add(new DataColumn("system"));
dt.Columns.Add(new DataColumn("delitem"));
foreach (XmlNode menuitem in mainmenus)
{
DataRow dr = dt.NewRow();
dr["id"] = menuitem["id"].InnerText;
dr["title"] = menuitem["title"].InnerText;
dr["defaulturl"] = menuitem["defaulturl"].InnerText;
dr["system"] = menuitem["system"].InnerText != "0" ? "是" : "否";
if (menuitem["mainmenulist"].InnerText != "")
dr["delitem"] = "删除";
else
dr["delitem"] = "<a href='managemainmenu.aspx?mode=del&menuid=" + menuitem["id"].InnerText + "' onclick='return confirm(\"您确认要删除此菜单项吗?\")'>删除</a>";
dt.Rows.Add(dr);
}
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
}
示例7: BindData
public void BindData()
{
#region 绑定轮换图片列表
DataGrid1.AllowCustomPaging = false;
DataGrid1.DataKeyField = "rotatepicid";
DataGrid1.TableHeaderName = "聚合轮换图片列表";
XmlDocumentExtender xmldocument = new XmlDocumentExtender();
xmldocument.Load(configPath);
XmlNode node = xmldocument.SelectSingleNode(targetNode);
if (node == null || node.ChildNodes.Count == 0)
{
DataGrid1.Visible = SaveRotatepic.Visible = false;
return;
}
XmlNodeReader rdr = new XmlNodeReader(node);
dsSrc.ReadXml(rdr);
dsSrc.Tables[0].Columns.Add("rowid");
int i = 0;
foreach (DataRow dr in dsSrc.Tables[0].Rows)
{
dr["rowid"] = i.ToString();
i++;
}
DataGrid1.DataSource = dsSrc.Tables[0];
DataGrid1.DataBind();
#endregion
}
示例8: GetWebsiteConfig
private DataTable GetWebsiteConfig()
{
#region 装载主题
DataTable dt = new DataTable();
dt.Columns.Add("tid");
dt.Columns.Add("title");
dt.Columns.Add("poster");
dt.Columns.Add("postdatetime");
dt.Columns.Add("showtype");
XmlDocumentExtender doc = new XmlDocumentExtender();
doc.Load(configPath);
XmlNodeList topiclistNode = doc.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist/Topic");
XmlNodeInnerTextVisitor topicvisitor = new XmlNodeInnerTextVisitor();
foreach (XmlNode topic in topiclistNode)
{
topicvisitor.SetNode(topic);
DataRow dr = dt.NewRow();
dr["tid"] = topicvisitor["topicid"];
dr["title"] = topicvisitor["title"];
dr["poster"] = topicvisitor["poster"];
dr["postdatetime"] = topicvisitor["postdatetime"];
dt.Rows.Add(dr);
}
return dt;
#endregion
}
示例9: LoadWebSiteConfig
private void LoadWebSiteConfig()
{
#region 装载个人空间信息
XmlDocumentExtender doc = new XmlDocumentExtender();
doc.Load(configPath);
XmlNodeList data_spacelistNode = doc.SelectNodes("/Aggregationinfo/Aggregationdata/" + pagename + "aggregationdata/" + pagename + "_spacelist/Space");
XmlNodeList index_spacelistnode = doc.SelectNodes("/Aggregationinfo/Aggregationpage/" + pagename + "/" + pagename + "_spacelist/Space");
XmlNodeInnerTextVisitor dataspacevisitor = new XmlNodeInnerTextVisitor();
XmlNodeInnerTextVisitor indexspacevisitor = new XmlNodeInnerTextVisitor();
int i = 0;
spacelist.Text = "";
foreach (XmlNode data in data_spacelistNode)
{
dataspacevisitor.SetNode(data);
bool isCheck = false;
foreach (XmlNode index in index_spacelistnode)
{
indexspacevisitor.SetNode(index);
if (dataspacevisitor["spaceid"].ToString() == indexspacevisitor["spaceid"].ToString())
{
isCheck = true;
break;
}
}
spacelist.Text += "<div class='mo' id='m" + i + "' flag='f" + i + "'><h1><input type='checkbox' name='sid' " + (isCheck ? "checked" : "") + " value='" + dataspacevisitor["spaceid"] + "'>" + dataspacevisitor["title"] + "</h1></div>\n";
i++;
}
#endregion
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// 在此处放置用户代码以初始化页面
allowUserGroup.Attributes.Add("onclick", "ChanageUserGroupStatus(this.checked)");
if (!IsPostBack)
{
EnableSpace.SelectedValue = config.Enablespace.ToString();
EnableSpace.Items[0].Attributes.Add("onclick", "ShowHiddenOption(true);");
EnableSpace.Items[1].Attributes.Add("onclick", "ShowHiddenOption(false);");
ShowSpaceOption.Attributes.Add("style", config.Enablespace == 1 ? "display:block" : "display:none");
ShowUserGroup.Attributes.Add("style", config.Enablespace == 1 ? "display:block" : "display:none");
LoadUserGroup();
XmlDocumentExtender xmlDoc = new XmlDocumentExtender();
xmlDoc.Load(Server.MapPath("../../config/space.config"));
XmlNode root = xmlDoc.SelectSingleNode("SpaceActiveConfigInfo");
XmlNodeInnerTextVisitor rootvisitor = new XmlNodeInnerTextVisitor();
rootvisitor.SetNode(root);
allowPostcount.Checked = rootvisitor["AllowPostcount"] == "1" ? true : false;
Postcount.Text = rootvisitor["Postcount"];
allowDigestcount.Checked = rootvisitor["AllowDigestcount"] == "1" ? true : false;
Digestcount.Text = rootvisitor["Digestcount"];
allowScore.Checked = rootvisitor["AllowScore"] == "1" ? true : false;
Score.Text = rootvisitor["Score"];
allowUserGroup.Checked = rootvisitor["AllowUsergroups"] == "1" ? true : false;
string groupList = rootvisitor["Usergroups"];
if (!allowUserGroup.Checked || groupList == "")
return;
else
BindUserGroup(groupList);
ActiveType.SelectedValue = rootvisitor["ActiveType"];
BindUserGorupMaxspaceattachsize();
}
}
示例11: saveinfo_Click
protected void saveinfo_Click(object sender, EventArgs e)
{
string configPath = Page.Server.MapPath("../xml/user_" + this.userid + ".config");
XmlDocumentExtender doc = new XmlDocumentExtender();
if (System.IO.File.Exists(configPath))
{
if (doc.SelectSingleNode("/UserConfig/ShowInfo") == null)
{
XmlNode userconfig = doc.CreateElement("UserConfig");
doc.AppendChild(userconfig);
XmlNode showinfo = doc.CreateElement("ShowInfo");
showinfo.InnerText = showhelp.SelectedValue.ToString();
userconfig.AppendChild(showinfo);
}
else
{
XmlNode showinfo = doc.SelectSingleNode("/UserConfig/ShowInfo");
showinfo.InnerText = showhelp.SelectedValue.ToString();
}
}
else
{
XmlElement userconfig = doc.CreateElement("UserConfig");
XmlElement showinfo = doc.CreateElement("ShowInfo");
showinfo.InnerText = showhelp.SelectedValue.ToString();
userconfig.AppendChild(showinfo);
doc.AppendChild(userconfig);
}
doc.Save(configPath);
this.RegisterStartupScript("PAGE", "window.location='likesetting.aspx'");
}
示例12: SaveTopic_Click
/// <summary>
/// 保存信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SaveTopic_Click(object sender, EventArgs e)
{
#region 保存信息
string tidlist = DNTRequest.GetString("forumtopicstatus");
//当未选择主题时,则清除所有选择
if (tidlist == "")
{
if (File.Exists(configPath))
{
XmlDocumentExtender doc = new XmlDocumentExtender();
doc.Load(configPath);
doc.RemoveNodeAndChildNode("/Aggregationinfo/Data/Hottopiclist");
doc.RemoveNodeAndChildNode("/Aggregationinfo/Forum/Hottopiclist");
doc.Save(configPath);
Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Aggregation/Hottopiclist");
}
Response.Redirect("aggregation_forumhottopic.aspx");
return;
}
else
{
//得到所选择帖子信息
Posts.WriteAggregationHotTopicsData(tidlist, configPath,
"/Aggregationinfo/Data/Hottopiclist",
"/Aggregationinfo/Forum/Hottopiclist");
Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Aggregation/Hottopiclist");
Response.Redirect("aggregation_edithottopic.aspx");
}
#endregion
}
示例13: BindData
public void BindData()
{
#region 绑定数据
DataGrid1.AllowCustomPaging = false;
DataGrid1.DataKeyField = "menuid";
DataGrid1.TableHeaderName = "我的菜单列表";
DataSet dsSrc = new DataSet();
XmlDocumentExtender xmldocument = new XmlDocumentExtender();
xmldocument.Load(configPath);
XmlNode node = xmldocument.SelectSingleNode("/menuset");
if (node == null ||node.ChildNodes.Count == 0)
return;
XmlNodeReader rdr = new XmlNodeReader(node);
dsSrc.ReadXml(rdr);
dsSrc.Tables[0].Columns.Add("menuid");
int i = 0;
foreach (DataRow dr in dsSrc.Tables[0].Rows)
{
dr["menuid"] = i.ToString();
i++;
}
DataGrid1.DataSource = dsSrc.Tables[0];
DataGrid1.DataBind();
#endregion
}
示例14: LoadInfo
private void LoadInfo()
{
string fids = "";
XmlDocumentExtender doc = new XmlDocumentExtender();
doc.Load(configPath);
XmlNode fidlist = doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist");
if (fidlist == null)
{
return;
}
fids = fidlist.InnerText;
string strJson = "";
Discuz.Common.Generic.List<ForumInfo> lists = Discuz.Forum.Forums.GetForumList();
foreach (string fid in fids.Split(','))
{
foreach (ForumInfo foruminfo in lists)
{
if (foruminfo.Fid.ToString() == fid)
{
strJson += "{'fid':'" + foruminfo.Fid + "','forumtitle':'" + foruminfo.Name + "'},";
break;
}
}
}
if (strJson != "")
{
strJson = strJson.TrimEnd(',');
}
strJson = "<script type='text/javascript'>\r\nvar fidlist = [" + strJson + "];\r\nfor(var i = 0 ; i < fidlist.length ; i++)\r\n{\r\nvar no = new Option();\r\nno.value = fidlist[i]['fid'];\r\nno.text = fidlist[i]['forumtitle'];\r\nForm1.list2.options[Form1.list2.options.length] = no;\r\n}\r\n</script>";
base.RegisterStartupScript("", strJson);
}
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
att.Columns.Add("typeid");
att.Columns.Add("typename");
att.Columns.Add("extname");
XmlDocumentExtender doc = new XmlDocumentExtender();
doc.Load(AppDomain.CurrentDomain.BaseDirectory + "config/myattachment.config");
XmlNodeList attachtype = doc.SelectNodes("/MyAttachmentsTypeConfigInfo/attachtypes/AttachmentType");
foreach (XmlNode node in attachtype)
{
DataRow dr = att.NewRow();
dr["typeid"] = node["TypeId"].InnerText;
dr["typename"] = node["TypeName"].InnerText;
dr["extname"] = node["ExtName"].InnerText != "" ? node["ExtName"].InnerText : "无绑定类型";
att.Rows.Add(dr);
}
dt = DatabaseProvider.GetInstance().GetAttachTypes();
string typeid = DNTRequest.GetString("typeid");
if (!Page.IsPostBack)
{
BindData();
string attlist = ""; //得到已绑定的附件列表
if (att != null)
{
foreach (DataRow dr in att.Rows)
{
attlist += dr["extname"].ToString() + ",";
}
attlist = attlist.TrimEnd(',');
}
attachextensions.AddTableData(dt);
foreach (string atttype in attlist.Split(','))
{
for (int i = 0; i < attachextensions.Items.Count; i++)
{
if (atttype == attachextensions.Items[i].Text)
{
attachextensions.Items[i].Enabled = false;
break;
}
}
}
string script = "var atttype = \r\n{";
if (att != null)
{
foreach (DataRow dr in att.Rows)
{
script += "\r\n\ttype" + dr["typeid"].ToString() + ":{typename:'" + dr["typename"].ToString() + "',extname:'" + dr["extname"].ToString() + "'},";
}
script = script.TrimEnd(',');
}
script += "\r\n};";
base.RegisterStartupScript("", "<script type='text/javascript'>\r\n" + script + "\r\n</script>");
}
}