Я использую Linq to XML с eBay API и не могу получить даже основную информацию из возвращенного XML.Я перепробовал каждую комбинацию from x in y select z
и т. Д., Но мне не повезло.
Я загружаю данные с помощью
var xml = XDocument.Load ("http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&SECURITY-APPNAME=***MY-KEY-OBSCURED**&RESPONSE-DATA-FORMAT=XML&REST-PAYLOAD&keywords=yamaha&paginationInput.entriesPerPage=1&paginationInput.pageNumber=1");
И я получаю следующий XML в соответствии с консолью и LINQPad.
<findItemsByKeywordsResponse xmlns="http://www.ebay.com/marketplace/search/v1/services"> <ack>Success</ack> <version>1.11.0</version> <timestamp>2011-09-04T12:15:10.595Z</timestamp> <searchResult count="1">
<item>
<itemId>220841819907</itemId>
<title>YAMAHA RX-V592 SURROUND SOUND RECEIVER</title>
<globalId>EBAY-US</globalId>
<primaryCategory>
<categoryId>14981</categoryId>
<categoryName>Receivers</categoryName>
</primaryCategory>
<galleryURL>http://thumbs4.ebaystatic.com/pict/2208418199074040_1.jpg</galleryURL>
<viewItemURL>http://www.ebay.com/itm/YAMAHA-RX-V592-SURROUND-SOUND-RECEIVER-/220841819907?pt=Receivers_Tuners</viewItemURL>
<productId type="ReferenceID">46568009</productId>
<paymentMethod>PayPal</paymentMethod>
<autoPay>false</autoPay>
<postalCode>76638</postalCode>
<location>Crawford,TX,USA</location>
<country>US</country>
<shippingInfo>
<shippingServiceCost currencyId="USD">22.0</shippingServiceCost>
<shippingType>Flat</shippingType>
<expeditedShipping>false</expeditedShipping>
<oneDayShippingAvailable>false</oneDayShippingAvailable>
<handlingTime>3</handlingTime>
<shipToLocations>US</shipToLocations>
</shippingInfo>
<sellingStatus>
<currentPrice currencyId="USD">51.0</currentPrice>
<convertedCurrentPrice currencyId="USD">51.0</convertedCurrentPrice>
<bidCount>13</bidCount>
<sellingState>Active</sellingState>
<timeLeft>P0DT0H18M17S</timeLeft>
</sellingStatus>
<listingInfo>
<bestOfferEnabled>false</bestOfferEnabled>
<buyItNowAvailable>false</buyItNowAvailable>
<startTime>2011-08-28T12:33:27.000Z</startTime>
<endTime>2011-09-04T12:33:27.000Z</endTime>
<listingType>Auction</listingType>
<gift>false</gift>
</listingInfo>
<returnsAccepted>false</returnsAccepted>
<condition>
<conditionId>3000</conditionId>
<conditionDisplayName>Used</conditionDisplayName>
</condition>
<isMultiVariationListing>false</isMultiVariationListing>
</item> </searchResult> <paginationOutput>
<pageNumber>1</pageNumber>
<entriesPerPage>1</entriesPerPage>
<totalPages>819204</totalPages>
<totalEntries>819204</totalEntries> </paginationOutput> <itemSearchURL>http://www.ebay.com/sch/i.html?_nkw=yamaha&_ddo=1&_ipg=1&_pgn=1</itemSearchURL> </findItemsByKeywordsResponse>
Может кто-нибудь помочь мне найти информацию 1-го уровня, такую как ack и version, а затем информацию, вложенную в searchResult-> Item.
Итак, под вышесказанным я подразумеваю значенияэлементов ...
findItemsByKeywordsResponse->ack
findItemsByKeywordsResponse->version
, а также вложенной информации
findItemsByKeywordsResponse->searchResult->item->itemId
findItemsByKeywordsResponse->searchResult->item->title
Я потратил несколько дней на поиски ответов, но не нашел рабочего решения.