I've an xml parser that parses the attached "testXML.xml" file absolutely correctly. My question is i might have to parse the "[email protected] xml" file and won't it make my parser extremely complicated since, I have to keep track of where the contacts of a particular group end. I'm storing the contents in a treeview with the group names being the parent and the contacts being the children.
So I wanted to get a feedback about parsing the "[email protected] xml" file or is it easy to do so.
Here's the code for parser and i've attached the two xml files:
VB Code:
Private Sub LoadXMLNode()
Dim xmlDoc As DOMDocument30
Dim intCounter As Integer
Set xmlDoc = New MSXML2.DOMDocument30
xmlDoc.Load ("C:\testXML.xml")
Call RecurseChildNodes(xmlDoc, xmlDoc.childNodes)
Set xmlDoc = Nothing
End Sub
Private Sub RecurseChildNodes(xmlDoc As MSXML2.DOMDocument30, childNode As IXMLDOMNodeList)
Dim CurrChildNode As IXMLDOMNodeList
Dim intNodeCounter As Integer
Dim Name As String
Dim childName As String
Dim thisNode As Node
Dim ctr As Integer
Dim childNum As Integer
ctr = 0
Set CurrChildNode = childNode
For intNodeCounter = 0 To CurrChildNode.Length - 1
If CurrChildNode.Length > 0 Then
Set childNode = CurrChildNode.Item(intNodeCounter).childNodes
If childNode.Length > 0 Then
RecurseChildNodes xmlDoc, childNode
If CurrChildNode.Item(intNodeCounter).nodeName = "Group" Then
Name = CurrChildNode.Item(intNodeCounter).Attributes.getNamedItem("type").nodeValue
Set thisNode = TreeView1.Nodes.Add(, , Name, Name)