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