Read xml using LINQ to Xml
<p>im trying to read an xml file using LINQ to XML, my logic seems to be fine as i have used the same logic in different application. but this time i gets "Object reference not set to an instance of an object." error when i get to foreach loop. Any help will be much appreciate.</p>

<p>C# Logic</p>

<pre><code>StringBuilder s=new StringBuilder();
            try
            {
                XDocument loaded = XDocument.Load(@"C:\logs\samplebrava.xml");
                XName qualifiedName = XName.Get("Author", "http://www.infograph.com");
                var xmlQuery =  from b in loaded.Descendants(qualifiedName)                               
                               select new
                               {
                                   Title = b.Element("Title").Value,
                                   Author = b.Element("Author").Attribute("name").Value,
                                   Comment = b.Element("Comment").Value
                               };
                foreach (var item in xmlQuery)                    
                s.AppendLine(item.Author + " - " + item.Title + " - " + item.Comment);
            }
            catch (Exception ex) { }
</code></pre>

<p>XML File</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;IGCMarkupDocument xmlns="http://www.infograph.com" majorversion="2" minorversion="6" revision="0"&gt;
   &lt;CDLInfo v1="3" v2="0" v3="2" v4="11"&gt;
      &lt;DriverInfo v1="1" v2="5" v3="2" v4="4"&gt;Emf2DL&lt;/DriverInfo&gt;
      &lt;DriverFormatVersion&gt;1&lt;/DriverFormatVersion&gt;
   &lt;/CDLInfo&gt;
   &lt;PageList&gt;
      &lt;Page index="0" left="0.0" bottom="0.0" right="42001.0" top="29701.0"&gt;
         &lt;AuthorList&gt;
            &lt;Author name="gdfsuez\aiimiadmin"&gt;
               &lt;Changemark id="0" time="1311772228" guid="59B4A74788C31F4DA8D96AB4607499C0" color="255|0|0" hyperlink="" comment=""&gt;
                  &lt;PointList pointcount="6"&gt;
                     &lt;Point&gt;
                        &lt;x&gt;5224.39&lt;/x&gt;
                        &lt;y&gt;27153.1&lt;/y&gt;
                     &lt;/Point&gt;
                     &lt;Point&gt;
                        &lt;x&gt;2882.42&lt;/x&gt;
                        &lt;y&gt;27153.1&lt;/y&gt;
                     &lt;/Point&gt;
                     &lt;Point&gt;
                        &lt;x&gt;2882.42&lt;/x&gt;
                        &lt;y&gt;24785.4&lt;/y&gt;
                     &lt;/Point&gt;
                     &lt;Point&gt;
                        &lt;x&gt;4756&lt;/x&gt;
                        &lt;y&gt;24785.4&lt;/y&gt;
                     &lt;/Point&gt;
                     &lt;Point&gt;
                        &lt;x&gt;5224.39&lt;/x&gt;
                        &lt;y&gt;25259&lt;/y&gt;
                     &lt;/Point&gt;
                     &lt;Point&gt;
                        &lt;x&gt;4756&lt;/x&gt;
                        &lt;y&gt;25259&lt;/y&gt;
                     &lt;/Point&gt;
                  &lt;/PointList&gt;
                  &lt;Title&gt;MJ1&lt;/Title&gt;
                  &lt;Comment&gt;Test&lt;/Comment&gt;
                  &lt;Viewstate Extents="false" ZoomWidth="true"&gt;
                     &lt;Page&gt;0&lt;/Page&gt;
                     &lt;ScaleFactor&gt;0.0388562&lt;/ScaleFactor&gt;
                     &lt;Rotation&gt;0.0&lt;/Rotation&gt;
                     &lt;EyePoint&gt;
                        &lt;x&gt;21000.5&lt;/x&gt;
                        &lt;y&gt;16369.8&lt;/y&gt;
                     &lt;/EyePoint&gt;
                     &lt;DeviceRect&gt;
                        &lt;top&gt;0&lt;/top&gt;
                        &lt;left&gt;0&lt;/left&gt;
                        &lt;bottom&gt;1037&lt;/bottom&gt;
                        &lt;right&gt;1633&lt;/right&gt;
                     &lt;/DeviceRect&gt;
                     &lt;LayerTable LayerCount="0"/&gt;
                  &lt;/Viewstate&gt;
               &lt;/Changemark&gt;
            &lt;/Author&gt;
         &lt;/AuthorList&gt;
      &lt;/Page&gt;
   &lt;/PageList&gt;
&lt;/IGCMarkupDocument&gt;
</code></pre>
