Daniel Golan

Daniel Golan

  • NA
  • 45
  • 40.8k

Xml Attributes

Dec 16 2010 1:04 PM
Hello, i have this code which reades the nodes and then populates a combolist. Could someone help me do the same with attributes ? :)



// Code 


 private void populateCombo()
        {
            cmbPlatform.Items.Clear();

            XmlDocument doc = new XmlDocument();
   doc.Load("C:/Users/Daxal/Desktop/example/VideoGames.xml");
   XmlNodeList nodeList = doc.SelectNodes("TGames/Game");

   foreach(XmlNode node in nodeList)
                if (!cmbPlatform.Items.Contains(node.SelectSingleNode("Name").InnerText))
       cmbPlatform.Items.Add(node.SelectSingleNode("Name").InnerText);
        }

Answers (12)