Home > Archive > ASP > March 2008 > ASP with XML isn't working :-(
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ASP with XML isn't working :-(
|
|
|
| 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>
| |
| Bob Barrows [MVP] 2008-03-17, 7:59 am |
| ShriJ wrote:
> 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")
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
|
|
|
|
|