var xelement = XElement.Parse(@"
	
	
 
	2007-01-01
	2007-12-31
 


 
	Member
 
 
	2007-01-01
	2007-12-31
 


 
	2006-01-01
	2006-12-31
 

01234
04556
427000000
427000000
23450
45890
");

var contextIds = from st in xelement.Elements("SampleTag")
				 join ct in
			( xelement
	.Elements("contet")
	.Elements("period")
	.Where (e => DateTime.Parse(e.Element("startDate").Value) >= new DateTime(2006,12,01) && 
	DateTime.Parse(e.Element("endDate").Value) <= new DateTime(2008,12,31))
	.Select (e => e.Parent.Attribute("id").Value)) on st.Attribute("contetRef").Value equals ct
	select st.Value;


 

Hi,
My input are:
Element: Sample Tag
Period:   2006-12-01 to 2008-12-31
I want to query first for getting all the SampleTag, then i have to read the contextRef value avaialble in that SampleTag.
 I need to filter the SampleTag using the period whose contextRef and content ID matches.
Finally I need to get the attibute value of the filtered SampleaTag. I have queried as shown in code block.
But I am getting an error "object reference not set to instance of an object" as contextIds value.
Please help me..