在对xml文件中的节点进行遍历的时候,应该注意以下一点:
假设nodes对象里面包含很多xml节点:
-----------------------------------------------------
XmlNode[] nodes;
foreach(XmlNode xn in nodes)
{
//exclude the comment node in the xml file
if (xn.NodeType == XmlNodeType.Comment)
{
continue;
}
// do your other logic here
}
-----------------------------------------
把comment节点排除掉
wisdom
本文介绍了一种在遍历XML文件中的节点时的有效方法——如何排除注释节点以提高处理效率。通过使用C#代码示例,展示了如何利用foreach循环遍历节点并过滤掉不需要的注释节点。
2283

被折叠的 条评论
为什么被折叠?



