Access VBA count nodes in XML

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.
 
R

Rick Brandt

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?
 
G

Guest

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.
 
R

Rick Brandt

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top