i have given a code snippet below...
though i check for nullability before i do the actual processing... it still throws an unhandled exception.....

is there a way to handle this other than filling my code with try catch blocks....

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Windows.Forms;

namespace SSRS_Companion
    class DataSources
        public string name = string.Empty;
        public string ID = string.Empty;
        public string reference = string.Empty;

        public void getContent(XmlNode node)
                XmlElement nodeAsElement = node as XmlElement;
                    this.name = new string(node.Attributes["Name"].Value.ToCharArray());
                node = nodeAsElement.GetElementsByTagName("rd:DataSourceID")[0];
                    this.ID = new string(node.Value.ToCharArray());
                node = nodeAsElement.GetElementsByTagName("DataSourceReference")[0];
                    this.reference = new string( node.Value.ToCharArray());

and here's the screenshot

This question has already been answered. Start a new discussion instead.