Steffen Leppert
7/27/2010 6:20:00 PM
Okay, looks good, thanks, but an intermediate question, please...
I think the code below is relatively easy to read.
Do you have any idea what I'm doing wrong?
Some nodes are not debug.print'ed.
In the code you gave me, they ARE shown.
I guess I am missing something obvious here...
Private sub pStart
Dim Doc As MSXML2.DOMDocument60
Set Doc = New MSXML2.DOMDocument60
Doc.async = False
Call Doc.Load("C:\myfile.xml")
Dim first As MSXML2.IXMLDOMElement
Set first = Doc.documentElement.firstChild
Call pList(first, "")
End Sub
Private Sub pList(ByVal uNode As MSXML2.IXMLDOMNode, ByVal uTab As String)
DoEvents
If Not uNode.hasChildNodes Then
Exit Sub
End If
Dim child As MSXML2.IXMLDOMNode
For Each child In uNode.childNodes
Debug.Print uTab & "Node Name: " & uNode.nodeName & ", Value: "
& uNode.nodeValue
Dim a As MSXML2.IXMLDOMAttribute
For Each a In uNode.Attributes
Debug.Print uTab & "Attribute Name: " & a.Name & ", Value:
" & a.Value
Next a
If child.hasChildNodes Then
'call recursively
pList child, uTab & vbTab
End If
Next child
End Sub