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("MSXML 2.DomDocum ent.4.0")
xslDoc.async = false
xslDoc.load(Server.MapPath ("feedTran sform.xslt "))
Set xmlFeedlist = Server.CreateObject("MSXML 2.DomDocum ent.4.0")
Set oRoot = xmlFeedlist.createElement( "rss")
oRoot.setAttribute "version", "2.0"
xmlFeedlist.appendChild(oR oot)
'load feed 1
Set xmlFeed1 = Server.CreateObject("MSXML 2.DomDocum ent.4.0")
xmlFeed1.async = false
xmlFeed1.Load(getXmlFeed(" http://xx.com/index.xml"))
If Not xmlFeed1.documentElement Is Nothing Then
oRoot.appendChild(xmlFeed1 .documentE lement.chi ldNodes(0) .cloneNode (true))
End if
'load feed 2
Set xmlFeed2 = Server.CreateObject("MSXML 2.DomDocum ent.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 .documentE lement.chi ldNodes(0) .cloneNode (true))
End if
function getXmlFeed(sUrl)
Dim oXMLHttp
Dim oADORec
Dim sXML
Set oXMLHttp = Server.CreateObject("Msxml 2.ServerXM LHTTP.4.0" )
oXMLHttp.open "GET", sUrl, false
oXMLHttp.send() ' Send the request.
getXmlFeed = oXMLHttp.ResponseBody
set oXMLHttp = nothing
End function
xmlFeedlist.transformNodeT oObject 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("Msxml 2.ServerXM LHTTP.4.0" )
oXMLHttp.open "GET", sUrl, false
oXMLHttp.send() ' Send the request.
getXmlFeed = oXMLHttp.ResponseBody
set oXMLHttp = nothing
End function
%>
thanks!
aenders
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("MSXML
xslDoc.async = false
xslDoc.load(Server.MapPath
Set xmlFeedlist = Server.CreateObject("MSXML
Set oRoot = xmlFeedlist.createElement(
oRoot.setAttribute "version", "2.0"
xmlFeedlist.appendChild(oR
'load feed 1
Set xmlFeed1 = Server.CreateObject("MSXML
xmlFeed1.async = false
xmlFeed1.Load(getXmlFeed("
If Not xmlFeed1.documentElement Is Nothing Then
oRoot.appendChild(xmlFeed1
End if
'load feed 2
Set xmlFeed2 = Server.CreateObject("MSXML
xmlFeed2.async = false
xmlFeed2.Load(getXmlFeed("
If Not xmlFeed2.documentElement Is Nothing Then
' We want the channel node, which is the child of the root element
oRoot.appendChild(xmlFeed2
End if
function getXmlFeed(sUrl)
Dim oXMLHttp
Dim oADORec
Dim sXML
Set oXMLHttp = Server.CreateObject("Msxml
oXMLHttp.open "GET", sUrl, false
oXMLHttp.send() ' Send the request.
getXmlFeed = oXMLHttp.ResponseBody
set oXMLHttp = nothing
End function
xmlFeedlist.transformNodeT
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("Msxml
oXMLHttp.open "GET", sUrl, false
oXMLHttp.send() ' Send the request.
getXmlFeed = oXMLHttp.ResponseBody
set oXMLHttp = nothing
End function
%>
thanks!
aenders
ASKER
Thanks, but I was looking for help on incorporating it into the code above.
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.Fi leSystemOb ject")
Set objTextFile = objFSO.CreateTextFile(Serv er.MapPath ("blogfeed s.xml"))
objTextFile.Write(xmlFeedl ist.transf ormNodeToO bject(xsl) )
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
I get this error: Type mismatch: 'xmlFeedlist.transformNode ToObject'
Thank you!
aenders
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.Fi
Set objTextFile = objFSO.CreateTextFile(Serv
objTextFile.Write(xmlFeedl
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
I get this error: Type mismatch: 'xmlFeedlist.transformNode
Thank you!
aenders
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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