Link to home
Start Free TrialLog in
Avatar of aenders
aenders

asked on

Aggregate numerous RSS feeds into a single xml file, reorder by most recent and display 6

I am trying to create an xml file made from various RSS feeds in order by most recent. I plan on accessing this master xml file to display 6 most recent blog entries. At the moment it's dynamic (an xslt reorders by date posted and displays only 6)  but with 17 blogs being read it's slowing down the page that's loading them.

I would like to aggregate all 17 blogs to a single xml file and have a cron job run the asp file that generates the file. In a perfect world it would reorder them and display only 6.

Here is what I have for my dynamic feed written in classic ASP. How do I make it write to a file?

<%
Set xslDoc = Server.CreateObject("MSXML2.DomDocument.4.0")
xslDoc.async = false
xslDoc.load(Server.MapPath("feedTransform.xslt"))

Set xmlFeedlist = Server.CreateObject("MSXML2.DomDocument.4.0")
Set oRoot = xmlFeedlist.createElement("rss")
oRoot.setAttribute "version", "2.0"
xmlFeedlist.appendChild(oRoot)

'load feed 1
Set xmlFeed1 = Server.CreateObject("MSXML2.DomDocument.4.0")
xmlFeed1.async = false
xmlFeed1.Load(getXmlFeed("http://xx.com/index.xml"))
If Not xmlFeed1.documentElement Is Nothing Then
     oRoot.appendChild(xmlFeed1.documentElement.childNodes(0).cloneNode(true))
End if


'load feed 2
Set xmlFeed2 = Server.CreateObject("MSXML2.DomDocument.4.0")
xmlFeed2.async = false
xmlFeed2.Load(getXmlFeed("http://xx.com/index.xml"))
If Not xmlFeed2.documentElement Is Nothing Then
     ' We want the channel node, which is the child of the root element
     oRoot.appendChild(xmlFeed2.documentElement.childNodes(0).cloneNode(true))
End if

function getXmlFeed(sUrl)

     Dim oXMLHttp
     Dim oADORec
     Dim sXML

      Set oXMLHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
      oXMLHttp.open "GET", sUrl, false
    oXMLHttp.send() ' Send the request.
      
      
      getXmlFeed = oXMLHttp.ResponseBody
      
      set oXMLHttp = nothing

End function

xmlFeedlist.transformNodeToObject xslDoc, response

Set oRoot = nothing
Set xslDoc = nothing
Set xmlFeedlist = nothing
Set xmlFeed1 = nothing
Set xmlFeed2 = nothing


function getXmlFeed(sUrl)

       Dim oXMLHttp
     Dim oADORec
     Dim sXML

      Set oXMLHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
      oXMLHttp.open "GET", sUrl, false
    oXMLHttp.send() ' Send the request.
      
      
      getXmlFeed = oXMLHttp.ResponseBody
      
      set oXMLHttp = nothing

End function

%>

thanks!
aenders
Avatar of jawahar_prasad
jawahar_prasad

Hi..
To write to a file
http://www.expertsforge.com/Web-Development/Tutorial-9.asp

Similar way u can write to .xml file in your server... Your asp page can call this xml file
Avatar of aenders

ASKER

Thanks, but I was looking for help on incorporating it into the code above.
Avatar of aenders

ASKER

Sorry, went away on vacation.

I see in the tutorial how to write to a file by entering text, but how do I get the xml feed to write to file. I can write to a file by sending it text, but how do I get the aggregated xml to write to file?

I tried:

Dim objFSO, objTextFile

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(Server.MapPath("blogfeeds.xml"))

objTextFile.Write(xmlFeedlist.transformNodeToObject(xsl))
objTextFile.Close


Set objTextFile = Nothing
Set objFSO = Nothing


I get this error: Type mismatch: 'xmlFeedlist.transformNodeToObject'

Thank you!
aenders
ASKER CERTIFIED SOLUTION
Avatar of jawahar_prasad
jawahar_prasad

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