Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - WebWiz RSS Funky
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

WebWiz RSS Funky

 Post Reply Post Reply
Author
kpdillon View Drop Down
Groupie
Groupie


Joined: 29 December 2006
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote kpdillon Quote  Post ReplyReply Direct Link To This Post Topic: WebWiz RSS Funky
    Posted: 01 May 2007 at 11:23pm
I use a standard XML script (pasted below) to display latest topics on my homepage using the webwiz forum RSS feed.  However, every so often someone posts a message I get the following error.  I never seem to have this problem with other RSS feeds, just randomly with WebWiz Forum feeds.
 
So my question is, can extra code be added to the RSS_topic_feed.asp to validate and replace invalid characters with proper ones for proper RSS support when a post happens with an invalid character?  Unfortunately I don't know which characters are causing the error so I am not expecting a miracle just some hope that someone will check into this.
 
BTW, this is a great script to use if you want to display content from the webwiz RSS feeds...
 
Here is the error I randomly receive with the standard code...
 
Error:
An invalid character was found in text content. Error has occured while trying to process www.myXXforum.com/forum/RSS_topic_feed.asp
Please contact web-master
 
 
Script:
<%
Response.Expires = -1

' =========== RSS2HTML.ASP for ASP/ASP.NET ==========
' copyright 2005-2007 (c) www.Bytescout.com
' version 1.22, 25 April 2007
' ===============================================
' ##############################################################
' ####### CHECK OUR COMMERCIAL PRODUCTS FOR ASP/ASP.NET: #######
' SWF Scout [ http://bytescout.com/swfscout.html ]- create, read, modify flash movies (SWF)
' PDFDoc Scout [ http://bytescout.com/pdfdocscout.html ]- generate PDF documents with security options (PDF)
' ##############################################################

' =========== configuration =====================
' ##### URL to RSS Feed to display #########
URLToRSS = "http://bytescout.com/blog/feed"

' ##### max number of displayed items #####
MaxNumberOfItems = 7

' ##### Main template constants
MainTemplateHeader = "<table>"
MainTemplateFooter = "</table>"
' #####

' ######################################
Keyword1 = "" ' Keyword1 = "tech" - set non-empty keyword value to filter by this keyword
Keyword2 = "" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too
' #################################

' ##### Item template.
' ##### {LINK} will be replaced with item link
' ##### {TITLE} will be replaced with item title
' ##### {DESCRIPTION} will be replaced with item description
' ##### {DATE} will be replaced with item date and time
' ##### {COMMENTSLINK} will be replaced with link to comments (if you use RSS feed from blog)
' ##### {CATEGORY} will be replaced with item category
ItemTemplate = "<tr><td><strong>{DATE}</strong><br/><strong>{CATEGORY}<br/></strong><a href=" & """{LINK}""" & ">{TITLE}</a><BR>{DESCRIPTION}</td></tr>"

' ##### Error message that will be displayed if not items etc
ErrorMessage = "Error has occured while trying to process " &URLToRSS & "<BR>Please contact web-master"

' ================================================

Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.3.0")
xmlHttp.Open "Get", URLToRSS, false
xmlHttp.Send()
RSSXML = xmlHttp.ResponseText

Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")
xmlDOM.async = False
xmlDOM.validateOnParse = False
xmlDom.resolveExternals = False

If not xmlDOM.LoadXml(RSSXML) Then
ErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason & vbCRLF & ErrorMessage
End If

Set xmlHttp = Nothing ' clear HTTP object

Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS

RSSItemsCount = RSSItems.Length-1

' if not <item>..</item> entries, then try to get <entry>..</entry>
if RSSItemsCount = -1 Then
Set RSSItems = xmlDOM.getElementsByTagName("entry") ' collect all "entry" (atom format) from downloaded RSS
RSSItemsCount = RSSItems.Length-1

End If

Set xmlDOM = Nothing ' clear XML


' writing Header
if RSSItemsCount > 0 then
Response.Write MainTemplateHeader
End If

j = -1

For i = 0 To RSSItemsCount
Set RSSItem = RSSItems.Item(i)

for each child in RSSItem.childNodes

Select case lcase(child.nodeName)
case "title"
RSStitle = child.text
case "link"
If RSSLink = "" Then
If child.Attributes.length>0 Then
RSSLink = child.GetAttribute("href")
if (RSSLink <> "") Then
if child.GetAttribute("rel") <> "alternate" Then
RSSLink = ""
End If
End If
End If ' if has attributes
If RSSLink = "" Then
RSSlink = child.text
End If
End If
case "description"
RSSdescription = child.text
case "content" ' atom format
RSSdescription = child.text
case "published"' atom format
RSSDate = child.text
case "pubdate"
RSSDate = child.text
case "comments"
RSSCommentsLink = child.text
case "category"
Set CategoryItems = RSSItem.getElementsByTagName("category")
RSSCategory = ""
for each categoryitem in CategoryItems
if RSSCategory <> "" Then
RSSCategory = RSSCategory & ", "
End If

RSSCategory = RSSCategory & categoryitem.text
Next
End Select
next

' now check filter
If (InStr(RSSTitle,Keyword1)>0) or (InStr(RSSTitle,Keyword2)>0) or (InStr(RSSDescription,Keyword1)>0) or (InStr(RSSDescription,Keyword2)>0) then

j = J+1

if J<MaxNumberOfItems then
ItemContent = Replace(ItemTemplate,"{LINK}",RSSlink)
ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle)
ItemContent = Replace(ItemContent,"{DATE}",RSSDate)
ItemContent = Replace(ItemContent,"{COMMENTSLINK}",RSSCommentsLink)
ItemContent = Replace(ItemContent,"{CATEGORY}",RSSCategory)

Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription)
ItemContent = ""
End if
End If

Next

' writing Footer
if RSSItemsCount > 0 then
Response.Write MainTemplateFooter
else
Response.Write ErrorMessage
End If

' Response.End ' uncomment this for use in on-the-fly output
%>

Back to Top
kpdillon View Drop Down
Groupie
Groupie


Joined: 29 December 2006
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote kpdillon Quote  Post ReplyReply Direct Link To This Post Posted: 12 May 2007 at 5:21am
No ideas here?
Back to Top
billgulch View Drop Down
Newbie
Newbie


Joined: 09 June 2007
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote billgulch Quote  Post ReplyReply Direct Link To This Post Posted: 14 June 2007 at 4:13pm
Just purchased my key for WebWiz this week.. lovin' it!  Clap
 
Anywhoo.. I ran into this exact problem.   I turned the feed into a static file and started stripping out stuff.  Finally found the culprit..
 
It appeared to happen because I "copied and pasted" from Word and had 3 ...'s in a row.  Word turns three dots into a special character.  WebWiz allows the character to be posted, which is great.. however..
 
The RSS feed writer for WebWiz doesn't strip it out.  The character is non-RSS compliant, so it bombs.  From resource.org -
 
"RSS 1.0 assumes UTF-8. Using US-ASCII (i.e. encoding all characters over 127 as &#nnn;) is conformant with UTF-8 (and ISO-8859-1, HTTP's default header encoding)."
 
So what I did was this.  In RSS_Topic_feed.asp I :
 
* Dimmed a new variable called MikeLoop in the declare variables section: dim MikeLoop
 
* Added the following code at line 305
 
for MikeLoop = 128 to 255
 strMessage=Replace(strMessage,chr(MikeLoop),"&#"+trim(MikeLoop)+";")
Next
 
Seems to work like a champ.  Wink
 
--Mike
 
 
 
 
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 14 June 2007 at 4:33pm
When posting from Word it does put in a load of unwanted code that does tend to mess things up.

Have you tried using the 'Paste From Word' Tool found in the full editor (not the quick reply) and if so does that prevent this error?
Back to Top
kpdillon View Drop Down
Groupie
Groupie


Joined: 29 December 2006
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote kpdillon Quote  Post ReplyReply Direct Link To This Post Posted: 15 June 2007 at 4:59am
Thanks, I'll try out this loop, My posts come from other forums automatically that I pull in from rss feeds so I run into this issue with out Microsoft word.  I'll give that loop a try!  As a workaround, I was using feedburner.  Whatever they do seems to filter out unwanted charachters.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.