I'm new to LINQ so I gather I just have some of my syntax wrong. I've looked at many examples online but everyone seems to have their own style.Here's the XML data I'm querying against:\[code\]<ajax-response> <response type="object" id="unknown"> <generic response="Success" message="Channel status will follow" /> </response> <response type="object" id="unknown"> <generic event="Status" privilege="Call" channel="SIP/452-000006fc" calleridnum="452" calleridname="Joe" connectedlinenum="430" connectedlinename="device" accountcode="" channelstate="6" channelstatedesc="Up" context="macro-dial-one" extension="s" priority="37" seconds="54" bridgedchannel="SIP/430-000006fd" bridgeduniqueid="1363822334.1829" uniqueid="1363822334.1828" /> </response> <response type="object" id="unknown"> <generic event="Status" privilege="Call" channel="SIP/430-000006fd" calleridnum="430" calleridname="device" connectedlinenum="452" connectedlinename="Joe" account="" state="Up" bridgedchannel="SIP/452-000006fc" bridgeduniqueid="1363822334.1828" uniqueid="1363822334.1829" /> </response> <response type="object" id="unknown"> <generic event="StatusComplete" items="2" /> </response></ajax-response>\[/code\]and here's what I have so far:\[code\]Function ParseXML(statusXML As XmlDocument) As String Dim xdoc As XDocument = XDocument.Load(New XmlNodeReader(statusXML)) Dim parsed As StringBuilder = New StringBuilder() Dim query = From generic In xdoc.Descendants("generic") _ Where generic.Attribute("privilege") IsNot Nothing And generic.Attribute("privilege").Value = "http://stackoverflow.com/questions/15537785/Call" _ Select connectedlinenum = generic.Attribute("connectedlinenum").ToString, _ calleridnum = generic.Attribute("calleridnum").ToString For Each i In query parsed.Append(i.connectedlinenum).Append(",").Append(i.calleridnum).Append(vbCrLf) Next Return parsed.ToStringEnd Function\[/code\]I'm guessing I am misunderstanding how my \[code\]generic\[/code\] object is supposed to be working, because I get a \[code\]NullReferenceException\[/code\] in my Where clause when I try to reference it.