It should be
while (xpCategories.MoveNext())
{
XPathNavigator n = xpCategories.Current;
Console.WriteLine(n.Value);
}
OR
foreach (XPathNavigator n in xpCategories)Console.WriteLine(n.Value);
Though I would recommend LINQ2XML
XDocument doc=XDocument.Load(xmlPath);
List<string> ids=doc.Elements("category")
.Select(x=>x.Element("id").Value)
.ToList();