views:

17

answers:

0

I am searching the fastest way to count some tags in a huge xml-file (120MB)

long Quantity;
XPathDocument xDocData = new XPathDocument(str_File_path);
XPathNavigator xNavData = xDocData.CreateNavigator();

//Option 1
XPathExpression xExp = xNavData.Compile("sum(Tag/Value)");
Quantity = Convert.ToInt64(xNavData.Evaluate(xExp));

//Option 2
XPathNodeIterator xNodeIter = xNavData.Select(xExp);
while(xNodeIter.MoveNext())
{
    Quantity += xNodeIter.Current.ValueAsLong;
}

Any suggestions?

greetings and thanks in advance