伯爵将XMLNode总数在C#

编程入门 行业动态 更新时间:2024-10-10 05:25:36
本文介绍了伯爵将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#

本文发布于:2023-11-11 08:23:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577875.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:伯爵   总数   XMLNode

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!