• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 631
  • Last Modified:

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
0
hboys
Asked:
hboys
  • 3
  • 2
1 Solution
 
Geert BormansCommented:
Hi hboys,

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


Cheers!
0
 
hboysAuthor Commented:
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
0
 
Geert BormansCommented:
hboys,
>  I scroll through these and actually grab the title or description text
> for each Listing

well create a node list
Set oNode = xmlDOM.selectNodes("//Listing")

and then for every x in oNode
x.getAttribute("title") and x.getAttribute("description")
0
 
hboysAuthor Commented:
Thanks Gertone worked a treat
0
 
Geert BormansCommented:
welcome
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now