本文整理汇总了C#中System.Web.UI.Design.XmlDocumentSchema类的典型用法代码示例。如果您正苦于以下问题:C# XmlDocumentSchema类的具体用法?C# XmlDocumentSchema怎么用?C# XmlDocumentSchema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlDocumentSchema类属于System.Web.UI.Design命名空间,在下文中一共展示了XmlDocumentSchema类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillTreeView
// This method fills a TreeView Web control from an XML file.
public void FillTreeView(TreeView treeVw, string fileName)
{
// Get a reference to the current HttpContext
HttpContext currentContext = HttpContext.Current;
int i, j, k;
TreeNode CurNode, NewNode;
// Create and load an XML document
XmlDocument XDoc = new XmlDocument();
XDoc.Load(currentContext.Server.MapPath(fileName));
// Get a map of the XML Document
XmlDocumentSchema xSchema = new XmlDocumentSchema(XDoc, "");
// Get a list of the root child views
IDataSourceViewSchema[] RootViews = xSchema.GetViews();
// Add each child to the TreeView
for (i = 0; i < RootViews.Length; i++)
{
NewNode = new TreeNode(RootViews[i].Name);
treeVw.Nodes.Add(NewNode);
CurNode = treeVw.Nodes[i];
// Get a list of children of this child
IDataSourceViewSchema[] ChildViews = RootViews[i].GetChildren();
// Add each child to the child node of the TreeView
for (j = 0; j < ChildViews.Length; j++)
{
NewNode = new TreeNode(ChildViews[j].Name);
CurNode.ChildNodes.Add(NewNode);
CurNode = CurNode.ChildNodes[j];
// Get a list of children of this child
IDataSourceViewSchema[] ChildVws = ChildViews[j].GetChildren();
// Add each child to the child node
for (k = 0; k < ChildVws.Length; k++)
{
NewNode = new TreeNode(ChildVws[k].Name);
CurNode.ChildNodes.Add(NewNode);
}
// Select the parent of the current child
CurNode = CurNode.Parent;
}
// Select the parent of the current child
CurNode = CurNode.Parent;
}
}