Result missing when indexing xpath query

sthe

New Member
Xml file here.The two following loops give different output, despite both doing essentially the same thing:\[code\]XPathNavigator nav = xmlDoc.CreateNavigator();foreach (object v in (XPathNodeIterator)nav.Evaluate(@"//*[heads!=1]/name")){ Console.Out.WriteLine(v);}for (int i = 1; i <= 3; i++){ Console.Out.Write(i); Console.Out.WriteLine(nav.Evaluate(string.Format("string(//*[heads!=1][{0}]/name)", i)));}\[/code\]Output: \[code\]ZaphodFrankie and BenjiEddie1Zaphod2Frankie and Benji3\[/code\]Why is "Eddie" missing off the end of the for loop?
 
Back
Top