473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem loading an online XML

132 100+
Hello everybody,

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
  1. <?xml>
  2.     <onair>
  3.         <channelCode>55</channelCode>
  4.         <startDate>2013-11-12T21:27:21.000Z</startDate>
  5.         <endDate>2013-11-12T21:30:54.000Z</endDate>
  6.         <type>SONG</type>
  7.         <onairType>PREVIOUS</onairType>
  8.         <properties>
  9.             <property>
  10.                 <key>ARTISTNAME</key>
  11.                 <value>LIONEL RICHIE</value>
  12.             </property>
  13.             <property>
  14.                 <key>TITLE</key>
  15.                 <value>HELLO</value>
  16.             </property>
  17.         </properties>
  18.     </onair>
  19.     <onair>
  20.         <channelCode>55</channelCode>
  21.         <startDate>2013-11-12T21:30:53.000Z</startDate>
  22.         <endDate>2013-11-12T21:34:23.000Z</endDate>
  23.         <type>SONG</type>
  24.         <onairType>NOW</onairType>
  25.         <properties>
  26.             <property>
  27.                 <key>ARTISTNAME</key>
  28.                 <value>TRIXIE WHITLEY</value>
  29.             </property>
  30.             <property>
  31.                 <key>TITLE</key>
  32.                 <value>NEED YOUR LOVE </value>
  33.             </property>
  34.         </properties>
  35.     </onair>
  36. </onairs>
  37.  
And this is the code which I'm using:
Expand|Select|Wrap|Line Numbers
  1. string urlXML = "http://services.vrt.be/playlist/onair?channel_code=55&accept=application%2Fvnd.playlist.vrt.be.noa_1.0%2Bxml";
  2. XmlDocument xmlDoc = new XmlDocument();
  3. xmlDoc.Load(urlXML);
  4.  
  5. XmlNode titleNode = XmlDoc.SelectSingleNode("//onairs/onair/channelCode");
  6.  
  7. MessageBox.Show(titleNode.InnerText);
  8.  
The ultimate goal is to be able to extract the previous and current song information. However, in order to test my code I'm just trying to extract the value of the channelCode.

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
Nov 12 '13 #1
0 923

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Umashankar | last post by:
Dear Gurus, I am using listview control in a asp page to populate some database results.In some machines (which is having only OS and no other softwares installed) this control is not loading....
1
by: Nomad | last post by:
I'm trying to load an XML document into the DOM using the ActiveXObject I've succeeded in doing this on one machine. Which shouldn't becaus I've checked for the ActiveXObject and it doesn't...
1
by: Tom Vukovich | last post by:
I'm having a problem loading an xmldocument from the web. The xml i wish to bring into the application is generated from a request to an ASP page. The following code does not work. ...
2
by: NGM | last post by:
Hello All I have a unmanaged C++ DLL, which has been wrapped up with a manged C++ DLL. When i refer to this managed DLL in Windows form based applications it works out fine. But when i refer to...
2
by: Paul Ingles | last post by:
Hi, I have an ASP.NET Web Application which uses a number of controls in an external strongly named assembly. Whenever I view a page that uses one of the controls within the strongly named...
1
by: | last post by:
I have made a web application that is giving me an error in loading assemblies. It reports file not found (error message below). I know I have the .dll in the .bin directory for the application.: ...
5
by: Pete Marsh | last post by:
Wondering if anyone can recomend some sample code for dynamically loading the GD module. I have tried setting the extension dir in php.ini, and loading the GD module from there when apache is...
1
by: psybert | last post by:
(cross posted from JavaScript forum) Hello everyone, Long time lurker, first time poster. I'm a beginner coder, and I've taught myself everything with the help and expertise of users and websites...
6
by: Shigun | last post by:
On a website I am working on I am trying to load another page into a div on the the page the user does his work from. What I have works correctly in FireFox, but not in IE. I've rummaged Google for...
0
by: ndedhia1 | last post by:
I am having trouble loading a property file and keep getting this error when running my shell script that loads and runs my jar files, etc: no property file loaded, using defaults......
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.