Abhishek Kumar Ravi

Abhishek Kumar Ravi

  • NA
  • 11.5k
  • 4.4m

Why i 'm getting this NULL return | XML File

Feb 15 2014 3:34 PM
I have a XML which i want to parse. But, for some reasons its not working.
public Events()
{
InitializeComponent();
StreamResourceInfo xml = Application.GetResourceStream(new Uri("News.xml",UriKind.RelativeOrAbsolute));
data = XElement.Load(xml.Stream); // ERROR

this.ManipulationStarted += new EventHandler<ManipulationStartedEventArgs>(Events_ManipulationStarted);



}

void Events_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
{
var events = from item in data.Elements("Event") select item;

foreach( XElement temp in events )
{
eventItem.Add(new Model()
{
name =temp.Element("Name").Value,
image = temp.Element("Image").Value,
date = temp.Element("Date").Value,
time = temp.Element("Time").Value
});

myList.ItemsSource = eventItem;

}
}

Answers (2)