[thelist] RDF for ASP

Anthony Baratta Anthony@Baratta.com
Thu Jun 7 12:18:54 2001
At 09:33 AM 6/7/2001, you wrote:

>ok, i've tried a few different sources and have found nothing...
>
>i'm looking for an ASP solution to retrieving and displaying
>headlines as posted by an RDF feed... ideally, i'd like one that
>works on a shared host, and one that works on a box through the
>XML parser...

Heres some test code I was playing with a while back...
(shout out to Nicole for helping me with it ;-)

Note this uses MS XML and ASPTear COM object. The reason is that the XML 
COM Object has a nasty parsing bug. You need to strip the DOCTYPE in order 
for the XML to parse correctly. If you install the newest XML COM Object, 
you can use the new COM object without ASPTear and the ugly hack I used.

You can get the new XML Object here (watch for wrap):

http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/MS
DN-FILES/027/001/596/msdncompositedoc.xml


news.sap

<!--


         ASP - XML Test Page


MoreOver.com Test of XML Feed.....

<% '' MoreOver XML String.... varXMLPage = "http://p.moreover.com/cgi-local/page?c=Entertainment%3A%20film%20previews&o=xml" '' Isys XML Style String.... varXMLStyle = Server.MapPath("moreover.xsl") '' Getting XML from MoreOver Set xObj = Server.CreateObject("SOFTWING.AspTear") strRetVal = xObj.Retrieve(varXMLPage,2,"","","") varXMLPage_New = Replace(strRetVal,"","") varXMLPage_New = Replace(varXMLPage_New," encoding=""iso-8859-1""","") '' XML Object for Data Set XMLPage = CreateObject("Microsoft.XMLDOM") XMLPage.async = false returnValue_Page = XMLPage.loadXML(varXMLPage_New) '' XML Object for Style Set XMLStyle = CreateObject("Microsoft.XMLDOM") XMLStyle.async = false returnValue_Style = XMLStyle.load(varXMLStyle) '' Guts if (returnValue_Page AND returnValue_Style) then PageHTML = XMLPage.transformNode(XMLStyle) else PageHTML = "Error Retrieving XML Data & or Style Sheet" end if Out PageHTML sub Out(varString) Response.Write varString & "
" & vbCRLF end sub %> moreover.xls <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <table width="250" border="1" cellpadding="2" cellspacing="2"> <tr><td align="center">Header for Table</td></tr> <xsl:for-each select="moreovernews/article"> <tr><td> <a><xsl:attribute name="href"><xsl:value-of select="url" /></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute><xsl:value-of select="headline_text" /></a><br /> <xsl:value-of select="source" /><br /> </td></tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet> --> --- Anthony Baratta President Keyboard Jockeys