I'm encountering some issues while trying to load online XML-content. For some reason I can't select the nodes in the XML-document. Eventhough, if I try it with another source, it's working.
First of all, here is the structure of the XML:
Expand|Select|Wrap|Line Numbers
- <?xml>
- <onair>
- <channelCode>55</channelCode>
- <startDate>2013-11-12T21:27:21.000Z</startDate>
- <endDate>2013-11-12T21:30:54.000Z</endDate>
- <type>SONG</type>
- <onairType>PREVIOUS</onairType>
- <properties>
- <property>
- <key>ARTISTNAME</key>
- <value>LIONEL RICHIE</value>
- </property>
- <property>
- <key>TITLE</key>
- <value>HELLO</value>
- </property>
- </properties>
- </onair>
- <onair>
- <channelCode>55</channelCode>
- <startDate>2013-11-12T21:30:53.000Z</startDate>
- <endDate>2013-11-12T21:34:23.000Z</endDate>
- <type>SONG</type>
- <onairType>NOW</onairType>
- <properties>
- <property>
- <key>ARTISTNAME</key>
- <value>TRIXIE WHITLEY</value>
- </property>
- <property>
- <key>TITLE</key>
- <value>NEED YOUR LOVE </value>
- </property>
- </properties>
- </onair>
- </onairs>
Expand|Select|Wrap|Line Numbers
- string urlXML = "http://services.vrt.be/playlist/onair?channel_code=55&accept=application%2Fvnd.playlist.vrt.be.noa_1.0%2Bxml";
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.Load(urlXML);
- XmlNode titleNode = XmlDoc.SelectSingleNode("//onairs/onair/channelCode");
- MessageBox.Show(titleNode.InnerText);
But for now I keep on running into "Object reference not set to an instance of an object"
Anyone sees what's going wrong?
best regards,
Kenneth