XPathNodeIterator オブジェクトで while ループしようとしています
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);
しかし、このループは一度だけ機能し、その後終了します。何が問題なのか理解できませんか?