jclemo
asked on
Count specific nodes in an xml document
I have an xml document with a similar schema as below.
<A>
<B>
<C>data</C>
<C>data</C>
</B>
<B>
<C>data</C>
<C>data</C>
<C>data</C>
</B>
</A>
I have a routine that reads the file and parses the data from it to an SQL DB which works perfectly. However, I have a need to count the number of unique "C" elements in the document. Currently I add the elements to a counter as I enumerate through the document but I would really like to do this at the beginning before I start the main routine. Is there a method in VB.net that allows me to do this using the xmldocument?
<A>
<B>
<C>data</C>
<C>data</C>
</B>
<B>
<C>data</C>
<C>data</C>
<C>data</C>
</B>
</A>
I have a routine that reads the file and parses the data from it to an SQL DB which works perfectly. However, I have a need to count the number of unique "C" elements in the document. Currently I add the elements to a counter as I enumerate through the document but I would really like to do this at the beginning before I start the main routine. Is there a method in VB.net that allows me to do this using the xmldocument?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.