Working with XML Document Nodes : XML Data « XML « VBA / Excel / Access / Word






Working with XML Document Nodes

 
Sub LearnAboutNodes() 
    Dim xmldoc As MSXML2.DOMDocument50 
    Dim xmlNode As MSXML2.IXMLDOMNode 

    Set xmldoc = New MSXML2.DOMDocument50 
    xmldoc.async = False 

    xmldoc.Load ("C:\yourFile.xml") 
    If xmldoc.hasChildNodes Then 
        Debug.Print "Number of child Nodes: " & xmldoc.childNodes.length 
        For Each xmlNode In xmldoc.childNodes 
            Debug.Print "Node name:" & xmlNode.nodeName 
            Debug.Print "Type:" & xmlNode.nodeTypeString & "(" & xmlNode.nodeType & ")" 
            Debug.Print "Text: " & xmlNode.Text 
        Next xmlNode 
    End If 
    Set xmlDoc = Nothing 
End Sub 

 








Related examples in the same category

1.Loading and Retrieving the Contents of an XML File
2.Retrieving Information from Element Nodes
3.Retrieving Specific Information from Element Nodes
4.Retrieving the First Matching Node