I'm trying to create a list of all nodes from XML file. I created the functions below , I get an "argument not optional" error. This occurs when the node haschild node then calls the function again. Any ideas?
Thank you
Sub CreateList()
xmlExportDoc = "E:\Software Developement\SystemConfig.xml"
Dim xmldoc As MSXML2.DOMDocument
Dim xmlNodelist As MSXML2.IXMLDOMNodeList
Set xmldoc = New MSXML2.DOMDocument
xmldoc.async = False
xmldoc.Load (xmlExportDoc)
Set xmlNodelist = xmldoc.SelectNodes("/SystemConfig/Nodes/Node")
On Error Resume Next
ListNodes xmlNodelist
Set xmldoc = Nothing
Debug.Print "DONE!"
End Sub
Sub ListNodes(ByVal Nodes As MSXML2.IXMLDOMNodeList)
Dim xNode As MSXML2.IXMLDOMNode
For Each xNode In Nodes
Debug.Print xNode.Attributes(0).Text
If xNode.HasChildNodes Then
ListNodes (xNode.ChildNodes)
End If
Next xNode
End Sub
Thank you
Sub CreateList()
xmlExportDoc = "E:\Software Developement\SystemConfig.xml"
Dim xmldoc As MSXML2.DOMDocument
Dim xmlNodelist As MSXML2.IXMLDOMNodeList
Set xmldoc = New MSXML2.DOMDocument
xmldoc.async = False
xmldoc.Load (xmlExportDoc)
Set xmlNodelist = xmldoc.SelectNodes("/SystemConfig/Nodes/Node")
On Error Resume Next
ListNodes xmlNodelist
Set xmldoc = Nothing
Debug.Print "DONE!"
End Sub
Sub ListNodes(ByVal Nodes As MSXML2.IXMLDOMNodeList)
Dim xNode As MSXML2.IXMLDOMNode
For Each xNode In Nodes
Debug.Print xNode.Attributes(0).Text
If xNode.HasChildNodes Then
ListNodes (xNode.ChildNodes)
End If
Next xNode
End Sub