我正在尝试在 XPathNodeIterator 对象上进行循环
XPathNodeIterator xpCategories = GetCategories().Current.Select("/root/category/id");
现在 xpCategories 拥有这样的 xml
<root>
<category numberofproducts="0">
<id>format</id>
<name>Kopi/Print</name>
</category>
<category numberofproducts="1">
<id>frankering</id>
<name>Kopi/Print</name>
</category>
<category numberofproducts="0">
<id>gardbøjler</id>
<name>Møbler</name>
</category>
<category numberofproducts="0">
<id>gardknager</id>
<name>Møbler</name>
</category>
<category numberofproducts="0">
<id>gardspejle</id>
<name>Møbler</name>
</category>
</root>
我需要在循环中获取每个类别节点“id”。尝试过这样的事情
XPathNodeIterator xpCategories = GetCategories().Current.Select("/root/category/id");
while (xpCategories.MoveNext())
Console.WriteLine(xpCategories.Current.Value);
但是这个循环在它退出后只工作一次。我不明白出了什么问题?