本文整理匯總了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;
}
}