asked on
Dim objxmldoc As New MSXML2.DOMDocument60
Dim MyCount As MSXML2.IXMLDOMNodeList
open/load/namespace etc...
Set MyCount = objxmldoc.selectNodes("//ns1:yourtagtocount")
It would help if we could see your code so far...
Public Function GetCountOfNodesByTagNameList(ByVal parmXMLString, ByVal parmNodeTagList, Optional parmDelim = "^") As Long
Dim oDoc As Object
Dim vTag As Variant
Dim lngCount As Long
Set oDoc = CreateObject("MSXML2.DOMDocument")
oDoc.LoadXML parmXMLString
For Each vTag In Split(parmNodeTagList, parmDelim)
lngCount = lngCount + oDoc.getElementsByTagName(vTag).Length
Next
Set oDoc = Nothing
GetCountOfNodesByTagNameList = lngCount
End Function
Example of invoking the function, looking for nodes "a" and "b" and "root"?GetCountOfNodesByTagNameList("<root><a>1</a><a>2</a><b><a>3</a></b></root>","a^b^root")
5
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.
TRUSTED BY
Alternatively, you might iterate every node, keeping a tally of nodes as you traverse the tree.