Tommy

Tommy

  • NA
  • 134
  • 26.9k

How can I read some data from xml and display on label?

Jan 22 2013 6:06 PM
Hi,
I cannot get over an issue that I am having and I've been stuck on it for days.
Basically, I have an xml file mydisp.xml
Here's content of it (please note, it's complete content of xml file, without '<?xml version="1.0"...'):
<Schedule System="Program">
 <Event status="ongoing" timestarted="06:00:44" eventType="play">
  <Information screen=""/>
  <Pack title="Title goes here">
  <Client name="Client name">
  <CE runTime="500286"/>
  <Out Time="07:17:35"/>
  </Client>
  </Pack>
 </Event>
</Schedule>
I'd like to retrieve elements "status, timestarted, Pack title, Client name, CE runTime, Out Time" and display on my multiple labels.text;
However, I keep having many issues. It seems c# kickes many exceptions because xml has '=' symbol and it looks more like a string.
I'd like to use Linq or xPath methods for retrieving the data as it must be very fast.
Please, can somebody help me with the code? How can I write this code and place inside onFormLoad? What used System references I must use?
Thank you everyone for your help.
Tommy


Answers (6)