How about this?
XmlDocument doc = new XmlDocument();
doc.Load(@"~/XML/XML.xml");
var nodes = doc.SelectNodes("warehouse/cat[@id='computer']/item/SN");
myDropDown.DataTextField = "InnerText";
myDropDown.DataValueField = "InnerText";
//now bind the dropdownlist to the dataview
myDropDown.DataSource = nodes;
myDropDown.DataBind();
Load the xml into an XElement:
var xml = XElement.Load("test.xml");
Execute XPath to select the SN elements in the cats with id computer: (+ put them in a list)
var snValues = xml.XPathSelectElements("//cat[@id='computer']/item/SN")
.Select(x => x.Value).ToList();
Required usings:
using System.Linq;
using System.Xml.Linq;
using System.Xml.XPath;