Despite publishing invalid XML (without root node), an easy way to iterate through <FieldRef> Elements should use the XmlReader.ReadToFollowing
method:
//Keep reading until there are no more FieldRef elements while (reader.ReadToFollowing("FieldRef")) { //Extract the value of the Name attribute string value = reader.GetAttribute("Name"); }
Of course, a more flexible and smoother interface is provided by LINQ to XML, maybe it would be easier to use this if it is available within the framework of the .NET platform that you are aiming for? Then the code will look like this:
using System.Xml.Linq;
James shuttler
source share