我正在寻找在一个巨大的 xml 文件(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;
}
有什么建议么?
提前问候和感谢