Originally posted by pradeep chellappan: I was expecting the output as 2 since there are two elements under the element "Mainfolder".
But you wrote code that asked for a list of elements which are descendants of the root and whose name is "MainFolder" (not "Mainfolder"). There are no such elements. The root does indeed have two element children (and three text children, by the way) but neither of them is named "MainFolder".
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com