次のようなxmlファイルがあります。
<SalesReps>
<SalesRep>
<repname> Bob</repname>
<repid>100</repid>
<customers>
<customer>
<custname>ABC Company</custname>
<custno>51233</custno>
</customer>
<customer>
<custname>XYZ Inc.</custname>
<custno>29943</custno>
</customer>
</customers>
</SalesRep>
<SalesRep>
<repname>Sue</repname>
<repid>43</repid>
<customers>
<customer>
<custname>Petes Tire Co</custname>
<custno>49999</custno>
</customer>
<customer>
<custname>Suzy's Sewing</custname>
<custno>81234</custno>
</customer>
</customers>
</SalesRep>
</SalesReps>
私は次のコードでそれを読み込もうとしています:
Dim salesreps = From reps In xe.Descendants("SalesReps") Select reps
Dim el = (From rep In salesreps _
Select New With {.repname = rep.<repname>, _
.repid = rep.<repid>,
.customers = (From custs In rep.<Customers> _
Select New With { _
.customer = ( _
From cust In custs.<customer> _
Select New With {
.custname = cust.<custname>.Value, _
.custno = cust.<custno>.Value} _
)} _
) _
} _
)
repname と repid は取得できますが、custname と custno で顧客リストを取得できません。私は何を間違っていますか?
どうも