Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27348

VS 2010 Processing XML - Working, but can't get sub items?

$
0
0
Hi,

I am using the Ebay API to get lists of items. I can get the item ID and Title easy enough, but not the price etc as the XML sheet displays these at sub items.

Here is the XML:

Code:

<?xml version="1.0" encoding="UTF-8"?>
<findItemsByKeywordsResponse>
  <ack>Success</ack>
  <version>1.12.0</version>
  <timestamp>2013-09-21T16:24:53.632Z</timestamp>
  <searchResult count="1">
      <item>
        <itemId>130996071573</itemId>
        <title>Microsoft Xbox 360 S 250 GB Glossy Black Console (PAL)  RGH</title>
        <globalId>EBAY-GB</globalId>
        <primaryCategory>
            <categoryId>139971</categoryId>
            <categoryName>Consoles</categoryName>
        </primaryCategory>
        <galleryURL>http://thumbs2.ebaystatic.com/m/mQyTtyioaoKMZTh9J1Y-XbQ/140.jpg</galleryURL>
        <viewItemURL>http://www.ebay.co.uk/itm/Microsoft-Xbox-360-S-250-GB-Glossy-Black-Console-PAL-RGH-/130996071573?pt=UK_VideoGames_VideoGameConsoles_VideoGameConsoles</viewItemURL>
        <productId type="ReferenceID">100235209</productId>
        <paymentMethod>PayPal</paymentMethod>
        <autoPay>false</autoPay>
        <postalCode>TS198NB</postalCode>
        <location>Stockton-on-Tees,United Kingdom</location>
        <country>GB</country>
        <shippingInfo>
            <shippingServiceCost currencyId="GBP">13.0</shippingServiceCost>
            <shippingType>Flat</shippingType>
            <shipToLocations>GB</shipToLocations>
        </shippingInfo>
        <sellingStatus>
            <currentPrice currencyId="GBP">100.0</currentPrice>
            <convertedCurrentPrice currencyId="GBP">100.0</convertedCurrentPrice>
            <bidCount>0</bidCount>
            <sellingState>Active</sellingState>
            <timeLeft>P0DT0H34M14S</timeLeft>
        </sellingStatus>
        <listingInfo>
            <bestOfferEnabled>false</bestOfferEnabled>
            <buyItNowAvailable>false</buyItNowAvailable>
            <startTime>2013-09-18T17:00:08.000Z</startTime>
            <endTime>2013-09-21T16:59:07.000Z</endTime>
            <listingType>Auction</listingType>
            <gift>false</gift>
        </listingInfo>
        <condition>
            <conditionId>3000</conditionId>
            <conditionDisplayName>Used</conditionDisplayName>
        </condition>
        <isMultiVariationListing>false</isMultiVariationListing>
        <topRatedListing>false</topRatedListing>
      </item>
  </searchResult>
</findItemsByKeywordsResponse>

And the code I am using to get the ID number and Title (The commented out code doesn't work):

Code:

    Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim xmlDoc As New Xml.XmlDocument

        xmlDoc.Load("EBAY XML LOCATION")

        Dim root As Xml.XmlNode = xmlDoc("findItemsByKeywordsResponse")
=

        For Each itemNode As Xml.XmlNode In root("searchResult")

            Dim ID As String = itemNode("itemId").InnerText
            Dim Title As String = itemNode("title").InnerText
            'Dim Price As String = itemNode("currentPrice").InnerText


            ListView1.Items.Add(New ListViewItem(New String() {ID, Title}))
        Next

    End Sub


Viewing all articles
Browse latest Browse all 27348

Trending Articles