ASP with XML isn't working :-(


S

ShriJ

Hi,

I am trying to read an RSS (generated from Y! pipes) in ASP. It isn't
working. any inputs will be highly appreciated.

I get an HTTP 500 error on IE on running it.

My code:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>

<%
Dim objXML
Dim objItemList
Dim objItem
Dim strHTML

On Error Resume Next

Set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
objXML.async = False

objXML.setProperty "ServerHTTPRequest", True
objXML.Load("http://pipes.yahoo.com/pipes/pipe.run?
_id=mpmmCsvz3BGjy6xQw5tC8g&_render=rss");

If objXML.parseError.errorCode <> 0 Then
Response.Write "<pre>" & vbCrLf
Response.Write "<strong>Error:</strong> " &
objXML.parseError.reason
Response.Write "<strong>Line:</strong> " &
objXML.parseError.line & vbCrLf
Response.Write "<strong>Text:</strong> " _
& Server.HTMLEncode(objXML.parseError.srcText) & vbCrLf
Response.Write "</pre>" & vbCrLf
End If

Set objItemList = objXML.getElementsByTagName("item")
Set objXML = Nothing
For Each objItem In objItemList
strHTML = strHTML & "<p>"
strHTML = strHTML & "<a href=""" & objItem.childNodes(1).text &
""">"
strHTML = strHTML & "<strong><em>" & objItem.childNodes(0).text
strHTML = strHTML & "</em></strong></a><br />" & vbCrLf
strHTML = strHTML & Replace(objItem.childNodes(2).text, "<br>",
"<br />") & vbCrLf
strHTML = strHTML & "<br><br><br><br>"
strHTML = strHTML & "</p>"
Next

Set objItemList = Nothing

Application.Lock
Application("MainContent") = strHTML
Application.UnLock
%>

<style type="text/css">
h3 {font-family: times;}
h4 {font-family: courier;}
p {font-family: times; }
</style>

<%= Application("MainContent") %>

</body>
</html>
 
Ad

Advertisements

B

Bob Barrows [MVP]

ShriJ said:
Hi,

I am trying to read an RSS (generated from Y! pipes) in ASP. It isn't
working. any inputs will be highly appreciated.

I get an HTTP 500 error on IE on running it.

Start by showing us the real error message:
http://www.aspfaq.com/show.asp?id=2109

Also tell us which line is producing your error (comment out that "on error
resume next")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top