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:noNamespaceSchemaLocat ion="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=12KPjg 1p9SoIGmmv mnAfSZH6eX wFsP5czn58 gaDIR7Gc0n wDA1Y9l7e6 HH2ZQmFvlk mg3x%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("MSXML 2.XMLHTTP" )
xmlHttp.Open "GET", URLToRSS, false
xmlHttp.Send()
RSSXML = xmlHttp.ResponseText
I then use
Set xmlDOM = Server.CreateObject("MSXML .DOMDocume nt")
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.getElementsByTagNam e("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
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:noNamespaceSchemaLocat
<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=12KPjg
</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("MSXML
xmlHttp.Open "GET", URLToRSS, false
xmlHttp.Send()
RSSXML = xmlHttp.ResponseText
I then use
Set xmlDOM = Server.CreateObject("MSXML
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.getElementsByTagNam
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
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Gertone worked a treat
welcome
try something like
Set attTitle = xmlDOM.selectSingleNode("/
Set attDesc = xmlDOM.selectSingleNode("/
Cheers!