Access VBA count nodes in XML

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

is there any count function for an XML object in VBA? i could count the
nodes by a loop but then i don't know how to return to the begining.. any
thoughts?

Set domDoc = XMLobj.GetNext(10000)
Dim row As Object
Dim countmyXMLRecords As Integer
Set row = domDoc.selectNodes("//row")
For r = 0 To row.Length - 1
countmyXMLRecords = countmyXMLRecords + 1
Next

but then if i want to use it further, the cursor is at row 10,000...

thanks,

dan.
 
Dan said:
Hello,

is there any count function for an XML object in VBA? i could count
the nodes by a loop but then i don't know how to return to the
begining.. any thoughts?

Set domDoc = XMLobj.GetNext(10000)
Dim row As Object
Dim countmyXMLRecords As Integer
Set row = domDoc.selectNodes("//row")
For r = 0 To row.Length - 1
countmyXMLRecords = countmyXMLRecords + 1
Next

but then if i want to use it further, the cursor is at row 10,000...

Isn't that what row.Length is giving you?
 
Rick,

thanks for your reply. I agree with rows.length but i still have to do
XMLobj.GetNext(10000). I don't know in the first place if i have 10,000 or
more notes... that's my confusion... any way to count all nodes without
for/next?


thanks,
Dan.
 
Dan said:
Rick,

thanks for your reply. I agree with rows.length but i still have to do
XMLobj.GetNext(10000). I don't know in the first place if i have
10,000 or more notes... that's my confusion... any way to count all
nodes without for/next?

I am not familiar with that XML method, but I would assume that if you are
only retrieving the XML 10,000 nodes at a time then you won't have any way
to tell how many there are in total until you have retrieved them all.
 
Back
Top