Private Function XmlToTree(ByVal Node As XmlNode, ByVal TreeNode As Microsoft.Web.UI.WebControls.TreeNodeCollection)
If Node.NodeType = XmlNodeType.Text Then
Dim tNode As New Microsoft.Web.UI.WebControls.TreeNode
tNode.Text = Node.Value
TreeNode.Add(tNode)
ElseIf Node.NodeType = XmlNodeType.Element Then
Dim Name As String
Name = Node.Name.ToString
If Node.Attributes.Count > 0 Then
Name = Name + "("
For Each Attr As XmlAttribute In Node.Attributes
Name = Name + Attr.Name + "=" + Attr.Value.ToString + " "
Next
Name = Name + ")"
End If
Dim tNode1 As New Microsoft.Web.UI.WebControls.TreeNode
tNode1.Text = Name
TreeNode.Add(tNode1)
For Each Node1 As XmlNode In Node.ChildNodes
XmlToTree(Node1, tNode1.Nodes)
Next
End If
End Function
If Node.NodeType = XmlNodeType.Text Then
Dim tNode As New Microsoft.Web.UI.WebControls.TreeNode
tNode.Text = Node.Value
TreeNode.Add(tNode)
ElseIf Node.NodeType = XmlNodeType.Element Then
Dim Name As String
Name = Node.Name.ToString
If Node.Attributes.Count > 0 Then
Name = Name + "("
For Each Attr As XmlAttribute In Node.Attributes
Name = Name + Attr.Name + "=" + Attr.Value.ToString + " "
Next
Name = Name + ")"
End If
Dim tNode1 As New Microsoft.Web.UI.WebControls.TreeNode
tNode1.Text = Name
TreeNode.Add(tNode1)
For Each Node1 As XmlNode In Node.ChildNodes
XmlToTree(Node1, tNode1.Nodes)
Next
End If
End Function