xml parsing select



i start to learn C# and i need some help.. i try to connect an xml file from the internet and set all is data in an selectList


i try to run this code..



XPathDocument document = new XPathDocument("http://ift.tt/1zbbdMU");
XPathNavigator navigator = document.CreateNavigator();

XPathExpression query = navigator.Compile("/CURRENCIES/CURRENCY");
XPathNodeIterator nodes = navigator.Select(query);
XPathNavigator nodesNavigator = nodes.Current;

XPathNodeIterator nodesText = nodesNavigator.SelectDescendants(XPathNodeType.Text, false);

while (nodesText.MoveNext())
{
selectList.Items.Add(nodesText.Current.Value);
}


but when i run it it add all the data from the xml in the selectList i want to take only the CURRENCYCODE list.. USD..GBP..


how i can get the text of the CURRENCYCODE or other else(what it need..)?


No comments:

Post a Comment