Link to home
Start Free TrialLog in
Avatar of hboys
hboys

asked on

Overture XML feed ASP processing

Hi,

I am trying to grab the xml returned from an overture feed to display sponsored results on a site.

The returned feed looks like:

<Results xsi:noNamespaceSchemaLocation="http://dtd.overture.com/schema/affiliate/2.8.3/OvertureSearchResults.xsd">
<ResultSet id="searchResults" numResults="3" adultRating="G">
     <Listing rank="1" title="Jobs in Northern Ireland" description="Search all available jobs in Northern Ireland from Loadzajobs.co.uk." siteHost="www.loadzajobs.co.uk" biddedListing="true" adultRating="G">
      <ClickUrl type="body">
http://www6.overture.com/d/sr/?xargs=15KPjg1lhSkpXyl%5FruNLbXU6TFhUBQy8zguJo0UMM6AYYB7jc2TvYrY6DEm9MrQO1k7QrQxPKQ9a4Aef7%2DmfmJFnj6TSf9b%2DP33%5FjG292ZAp%2DFKokEirIuwe7rmoJMP34OdDa8D6HP75jIU9f7OX4%5Fi4oKuwvA8PE%2D8f%5FfxOdsGb7Y0FJ6%5FFrCe5YE%2D%5FskgMTLW5h4SrVDI9SamiCfeIodxo4qxKSyYC1Id3m0u2INqkSGOjl9v6%5FNeplOtLXn2oLaPLeqw4UKPR3QrJsrtUL5jCXyit8ydCna2%2DwR%5FxpRCO%5FqITfcnkhjn5OcmrrWc4Mx%5FSbmRM3PRnz2QHJL&yargs=www.loadzajobs.co.uk
        </ClickUrl>
       </Listing>
     <NextArgs>
        Keywords=jobs&xargs=12KPjg1p9SoIGmmvmnAfSZH6eXwFsP5czn58gaDIR7Gc0nwDA1Y9l7e6HH2ZQmFvlkmg3x%5FcI%2E
     </NextArgs>
</ResultSet>
</Results>

I have a script that will read in the XML and grab the xml from overture via a

 Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP")
 xmlHttp.Open "GET", URLToRSS, false
 xmlHttp.Send()
 RSSXML = xmlHttp.ResponseText

I then use

 Set xmlDOM = Server.CreateObject("MSXML.DOMDocument")
 xmlDOM.LoadXml(RSSXML)
 
 Set xmlHttp = Nothing ' clear HTTP object

to load into a dom object and then look for the listing node via
Set RSSItems = xmlDOM.getElementsByTagName("Listing")

i then scroll through the nodes via

For i = 0 To RSSItemsCount
 Set RSSItem = RSSItems.Item(i)
  for each child in RSSItem.childNodes
    Select case lcase(child.nodeName)
    case "title"
    RSStitle = child.text


and so on.

this works to a degree but my main problem lies in the fact that the overture xml feed passes essential info in the main listing node such as:

<Listing rank="1" title="Jobs in Northern Ireland" description="Search all available jobs in Northern Ireland from Loadzajobs.co.uk." siteHost="www.loadzajobs.co.uk" biddedListing="true" adultRating="G">

my question is how under asp do I grab the value of the title and secription elements in the listing tag above?

Thanks in advance

H
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Hi hboys,

try something like
Set attTitle = xmlDOM.selectSingleNode("//Listing/@title")
Set attDesc = xmlDOM.selectSingleNode("//Listing/@description")


Cheers!
Avatar of hboys
hboys

ASKER

Thanks Gertone,

being a bit new to XML in asp how would I scroll through these and actually grab the title or description text for each Listing as although the example xml file above only shows one Listing element there are several in the real feed.

Thanks,

H
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hboys

ASKER

Thanks Gertone worked a treat