[thelist] RDF for ASP

Anthony Baratta Anthony at Baratta.com
Thu Jun 7 12:18:54 CDT 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):




         <title>ASP - XML Test Page</title>

<body><div align="center">
<p>MoreOver.com Test of XML Feed.....</p>
'' MoreOver XML String....
    varXMLPage = 

'' 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,"<!DOCTYPE moreovernews SYSTEM 
     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)
         PageHTML = "Error Retrieving XML Data & or Style Sheet"
     end if

     Out PageHTML

  sub Out(varString)
     Response.Write varString & "<br>" & vbCRLF
  end sub


<?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">
                 <a><xsl:attribute name="href"><xsl:value-of select="url" 
name="target">_blank</xsl:attribute><xsl:value-of select="headline_text" 
/></a><br />
                 <xsl:value-of select="source" /><br />


Anthony Baratta
Keyboard Jockeys

More information about the thelist mailing list