本文整理汇总了VB.NET中System.Web.UI.Design.XmlDocumentSchema类的典型用法代码示例。如果您正苦于以下问题:VB.NET XmlDocumentSchema类的具体用法?VB.NET XmlDocumentSchema怎么用?VB.NET XmlDocumentSchema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XmlDocumentSchema类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: XmlDocumentSchemaSample
' 导入命名空间
Imports System.Xml
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design
Public Class XmlDocumentSchemaSample
' This method fills a TreeView Web control from an XML file.
Public Sub FillTreeView(ByVal treeVw As TreeView, ByVal fileName As String)
' Get a reference to the current HttpContext
Dim currentContext As HttpContext = HttpContext.Current
Dim i, j, k As Integer
Dim CurNode, NewNode As TreeNode
' Create and load an XML document
Dim XDoc As New XmlDocument()
XDoc.Load(currentContext.Server.MapPath(fileName))
' Get a map of the XML Document
Dim xSchema As New XmlDocumentSchema(XDoc, "")
' Get a list of the root child views
Dim RootViews As IDataSourceViewSchema() = xSchema.GetViews()
' Add each child to the TreeView
For i = 0 To RootViews.Length - 1
NewNode = New TreeNode(RootViews(i).Name)
treeVw.Nodes.Add(NewNode)
CurNode = treeVw.Nodes(i)
' Get a list of children of this child
Dim ChildViews As IDataSourceViewSchema() = RootViews(i).GetChildren()
' Add each child to the child node of the TreeView
For j = 0 To ChildViews.Length - 1
NewNode = New TreeNode(ChildViews(j).Name)
CurNode.ChildNodes.Add(NewNode)
CurNode = CurNode.ChildNodes(j)
' Get a list of children of this child
Dim ChildVws As IDataSourceViewSchema() = ChildViews(j).GetChildren()
' Add each child to the child node
For k = 0 To ChildVws.Length - 1
NewNode = New TreeNode(ChildVws(k).Name)
CurNode.ChildNodes.Add(NewNode)
Next
' Select the parent of the current child
CurNode = CurNode.Parent
Next
' Select the parent of the current child
CurNode = CurNode.Parent
Next
End Sub
End Class
开发者ID:VB.NET开发者,项目名称:System.Web.UI.Design,代码行数:55,代码来源:XmlDocumentSchema
注:本文中的System.Web.UI.Design.XmlDocumentSchema类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论