473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

RSS feed

I have a script that has been modified from one that I found on the internet
to display RSS feeds in html. The script works fine for most RSS feeds but
there are a number that it fails on with the error "End tag 'head' does not
match the start tag 'meta'".

Does any one on here have any experience with this? The script is shown
below, the Neowin feed works but the google feed does not.

Any help would be appreciated.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim mydoc, responsexml, strXML, xmlhttp
Dim rss_list, rss_count

url = "http://news.google.co.uk/news?ned=uk&topic=w&output=rss"
' url = "http://www.neowin.net/fb.php?page=all"
'CREATE AN INSTANCE OF THE XMLHTTP OBJECT
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST",url,false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send strXML
responsexml = xmlhttp.responseText
'THE RETURNED TEXT 'responsexml' IS FORMATTED AS AN XML FILE.
'CREATE AN INSTANCE OF THE XML DOCUMENT OBJECT. THIS ENABLE'S YOU TO
MANIPULATE THE RETURNED DOCUMENT
Set mydoc=Server.CreateObject("Microsoft.xmlDOM")
mydoc.loadxml(responsexml)
dim total_node
If (mydoc.parseError.errorCode <0) Then
Dim myErr
Set myErr = mydoc.parseError
rss_feed = "You have error: " & myErr.reason
else
'GET THE NUMBER OF RETURNED NEWS ITEMS
Set NodeList = mydoc.documentElement.selectNodes("channel/item")
total_node = NodeList.length - 1
rss_count = "Total Node: " & NodeList.length
'NOW COLLECT THE NEWS ITEMS AND BUILD AN HTML STRING BLOCK THAT WILL BE
DISPLAYED LATER.
'YOU CAN FORMAT THIS FEED IN ANY WAY YOU WANT!
For x = 0 To total_node
feed = NodeList.Item(x).selectSingleNode("description").T ext
'EXTRACT THE FIRST LETTER OF THE FEED TO FORMAT IT DIFFERENTLY.
' feed_start = left(feed,1)
'EXTRACT THE REST OF THE BODY OF FEED
feed_body = right(feed,len(feed)-1)
if rss_feed <"" then rss_feed = rss_feed & "<hr>"
'GET TITLE
rss_feed = rss_feed & "<strong><h4>" &
NodeList.Item(x).selectSingleNode("title").Text & "</h4></strong>"
' rss_feed = rss_feed & "<span class='style_first_letter'>" & feed_start
& "</span>"
' 'GET BODY
' rss_feed = rss_feed & feed_body
'GET PUBLISHED DATE
rss_feed = rss_feed & "<br><em>Date Published: " &
NodeList.Item(x).selectSingleNode("pubDate").Text & "</em>"
'PROVIDE A 'READ MORE' LINK THAT LINKS TO THE ACTUAL NEWS LINK
rss_feed = rss_feed & "<br>" & "<a href='" &
NodeList.Item(x).selectSingleNode("link").Text & "' target='_blank'>Read
more</a>"

Next
end if
%>

<html>
<head>
<title>My News page</title>
</head>
<body>

<table border="0" cellpadding="5" cellspacing="0" width="100%" align="left">
<tr valign="top">
<td align="left">
<table width="45%" border="1" cellpadding="5" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF"><font size="2" face="Verdana, Arial,
Helvetica, sans-serif">

<%=rss_feed%>

</font></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Sep 21 '06 #1
1 2519
Steve wrote:
I have a script that has been modified from one that I found on the internet
to display RSS feeds in html. The script works fine for most RSS feeds but
there are a number that it fails on with the error "End tag 'head' does not
match the start tag 'meta'".
RSS doesn't have meta or head element types.
Do you mean the HTML that you are creating gives this error?

If so, it's because you are trying to parse HTML with an XML parser.
Original HTML is in SGML syntax, not XML, so <meta...does *not*
end with a /as it would in XHTML. If you're trying to output XHTML
then you need to make sure all EMPTY element types *do* end with />

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Sep 22 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kraft Bernhard | last post by:
Hallo list, I don't know if this is a apropriate Newsgroup for this thread but I found it via google and there are already some RSS question in here so I'm just asking: I have written a...
2
by: Brad Sanders | last post by:
Hello All, Thanks to Richard's answer to my last post I understand now what I have to do, but.. How do I put a Line Feed or a Form Feed into a text file? Looking throught the .net help it...
6
by: affiliateian | last post by:
Total newbie here for this so please be patient. We manually update our XML feed when we publish an article on our website. Can we add a javascript tracking pixel (from phpadsnew) into the XML...
4
by: Florian Lindner | last post by:
Hello, I'm looking for python RSS feed parser library. Feedparser http://feedparser.org/ does not seem to maintained anymore. What alternatives are recommendable? Thanks, Florian
5
by: Ed Flecko | last post by:
Hi folks, I'm trying to figure out this whole RSS feed thing. I've created my .xml file to use for my feed, and my browsers "recognize" that I have an RSS feed, and you can subscribe, etc., etc....
1
by: paul.hester | last post by:
Hi all, I work for a classified-type site and am planning on having an RSS feed for each category. I understand the basics of RSS, but I can't decide how often to update each RSS feed. Each...
4
by: Blake Garner | last post by:
I'm looking for suggestions on how to approach generating rss feed ..xml files using python. What modules to people recommend I start with? Thanks! Blake
10
by: bhass | last post by:
From my other post I am making a simple program that creates an RSS feed with Python. Now when I run my program so far, I get errors. It says "something is not defined". The word something is...
2
jamwil
by: jamwil | last post by:
What's up guys. I'm having some issues... I've created a method as part of my lifestreaming class which takes an rss feed, and puts the data into a database... It's fairly simple... Check...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.