I have got below xml format with me and I am using .NET 2.0.
You could do something like this
Using Linq
XDocument xDoc = XDocument.Load(@"Yourxmlfile.xml");
var query = from xEle in xDoc.Descendants("publication")
select new ListItem(xEle.Element("name").Value, xEle.Attribute("tcmid").Value);
ddlList.DataValueField = "value";
ddlList.DataTextField = "text";
ddlList.DataSource = query;
ddlList.DataBind();
Update: Using XmlDocument
XmlDocument xDocument = new XmlDocument();
xDocument.Load(@"YourXmlFile.xmll");
foreach (XmlNode node in xDocument.GetElementsByTagName("publication"))
{
ddlList.Items.Add(new ListItem(node.SelectSingleNode("name").InnerText,
node.Attributes["tcmid"].Value));
}
ddlList.DataValueField = "value";
ddlList.DataTextField = "text";
ddlList.DataBind();