本文介绍了伯爵将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#
发布评论