Is there a best practice for getting the number of elements from an XML document for the purpose of a progress report? I have a 2 GB XML file containing flights that I need to process, and my idea is to first get the number of all elements in the file, and then use the counter to display xx flights that are imported into our database.
To process files, we use XmlTextReader in .NET (C #) to get data without reading the entire document in memory (similar to the syntax formatting of sax).
So the question is how can I quickly get the number of these elements ... is there any best practice or should I go through the whole document first and do something like I ++;
Thanks!
user459611
source share