What i would like to to is to pull out specific nodes like for example Weatherdata/Forecast/Tabular/ and then how to pull the data out from
so that i only get time = 2010-12-16
Would really appreciate any help or guidelines ! :)
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Dec 17, 2010, 1:45 PM
XDocument xDoc = XDocument.Load(Server.MapPath("Country.xml"));var xmlAtt = from att in xDoc.Elements("CountryList").Elements("Name")
select att;
foreach (var record in xmlAtt)
{
if (record.FirstAttribute.Value == "2")
{
comboBox1.Items.Add(record.Value);
}
}
xDoc = null; xmlAtt = null;
Mark the post as accepted answer
Daniel GolanPosted Dec 17, 2010, 2:30 PM
Suthish NairPosted Dec 17, 2010, 2:19 PM
Daniel GolanPosted Dec 17, 2010, 2:10 PM
How do i then use the example to populate a ComboList and when i choose one value can click a btn to get the xml data to a rich text box ?
Suthish NairPosted Dec 17, 2010, 2:01 PM
Daniel GolanPosted Dec 17, 2010, 1:55 PM
Since getting error "The name "response" does not exist in the current document"
Daniel GolanPosted Dec 17, 2010, 1:15 PM
But when i use the combolist the values in the drop down is id="1" how can i filter away "id=" and only get the value ?
Second thing how can i then use the value (1) to open the corresponding xml data so by using the example the output to txtbox would be :
Name : Example
Platform: PC
xml example
Suthish NairPosted Dec 16, 2010, 1:22 PM
XDocument xmlDoc = XDocument.Load("C:/Users/Daxal/Desktop/example/VideoGames.xml");var xmlAtt = from att in xmlDoc.Elements("Weatherdata/Forecast/Tabular/").Elements("time")
select att;
foreach (var record in xmlAtt)
{
//put breakpoint in record and check the value, according to that baind the records
Split the value at "T" and get first array value.
}