I'm trying to grab some data using LINQ and a "WHERE" function within my "SELECT" function
Here's my sample XML
<Items>
<Extras>
<Extra Code="TEST1" Quantity="1" />
<Extra Code="TEST2" Quantity="1" />
</Extras>
<Options>
<OptionalExtra Description="Test 1" Code="TEST1" type="TESTING1" />
<OptionalExtra Description="Test 2" Code="TEST2" type="TESTING2" />
</Options>
</Items>
And here's my LINQ query
bookingsInfo = xel.Descendants("Extras").Descendants("Extra") _
.Select(Function(f) New With { _
.Code = f.Attributes("Code").First.Value, _
.Type = f.Parent.Parent.Descendants("Options").Descendants("OptionalExtra") _
.Where(Function(g) g.Attributes("Code").First.Value = _
f.Attributes("Code").First.Value).Attributes("type").First.Value, _
.Quantity = f.Attributes("Quantity").First.Value _
})
The "TYPE" is the problem I'm having trouble getting and I'm not really sure what the issue is.
I don't have any control of how the XML is laid out but I can edit the LINQ query no problem.
Does anyone have any suggestions?
Thanks in advance