give me please advice. I have this xml document:
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
  <!--This is an XML Generated File-->
    <DataGrid279.RecordStore>
     <StoreS Month="březen">
       <Date>7.3.2014</Date>
       <Amount>56</Amount>
     </StoreS>
     <StoreS Month="březen">
       <Date>7.3.2014</Date>
       <Amount>56</Amount>
     </StoreS>
     <StoreS Month="březen">
       <Date>7.3.2014</Date>
       <Amount>67</Amount>
     </StoreS>
   </DataGrid279.RecordStore>
I just wanna to sort this xml document and sorted result write back to the document. The exception NullReferenceException is being called when I use in labeled(**) line property Value which is reffered to Null. When I remove property Value the code is executed. How can I set property Value to correctly code executing?
public void Sort(string PATH,string month)
{
  XDocument doc = XDocument.Load(PATH);            
  **doc.Element("DataGrid279.RecordStore").ReplaceNodes(doc.Element("DataGrid279.RecordStore").Elements("StoreS").OrderBy(StoreS => StoreS.Attribute(month)));
  doc.Save(PATH);
}
Thanks
 
     
    