伯爵将XMLNode总数在C# [英] Count Total Number of XmlNodes in C#
本文介绍了伯爵将XMLNode总数在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图找到一种方式来获得的子节点由一个XmlNode递归总数。
I'm trying to find a way to get the total number of child nodes from an XmlNode recursively.
这是说我想算所有孩子,孙子女等。
That it is to say I want to count all the children, grand children etc.
我认为它像
node.SelectNodes(<fill in here>).Count
但我不知道是什么XPath是。
but I don't know what the XPath is.
推荐答案
的XPath支持所谓的轴描述,所以你要找的代码是
XPath supports something called Axis specifier, so the code you're looking for is
node.SelectNodes("descendant::*").Count
这篇关于伯爵将XMLNode总数在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文