473,762 Members | 8,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="VB SCRIPT" CODEPAGE="1252" %>
<%
Dim mydoc, responsexml, strXML, xmlhttp
Dim rss_list, rss_count

url = "http://news.google.co. uk/news?ned=uk&top ic=w&output=rss "
' url = "http://www.neowin.net/fb.php?page=all "
'CREATE AN INSTANCE OF THE XMLHTTP OBJECT
Set xmlhttp = Server.CreateOb ject("MSXML2.Se rverXMLHTTP")
xmlhttp.Open "POST",url,fals e
xmlhttp.setRequ estHeader "Content-Type", "applicatio n/x-www-form-urlencoded"
xmlhttp.send strXML
responsexml = xmlhttp.respons eText
'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.Cr eateObject("Mic rosoft.xmlDOM")
mydoc.loadxml(r esponsexml)
dim total_node
If (mydoc.parseErr or.errorCode <0) Then
Dim myErr
Set myErr = mydoc.parseErro r
rss_feed = "You have error: " & myErr.reason
else
'GET THE NUMBER OF RETURNED NEWS ITEMS
Set NodeList = mydoc.documentE lement.selectNo des("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 ).selectSingleN ode("descriptio n").Text
'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><h 4>" &
NodeList.Item(x ).selectSingleN ode("title").Te xt & "</h4></strong>"
' rss_feed = rss_feed & "<span class='style_fi rst_letter'>" & feed_start
& "</span>"
' 'GET BODY
' rss_feed = rss_feed & feed_body
'GET PUBLISHED DATE
rss_feed = rss_feed & "<br><em>Da te Published: " &
NodeList.Item(x ).selectSingleN ode("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 ).selectSingleN ode("link").Tex t & "' 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="#FFFFF F"><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 2574
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
1394
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 RSS Feed which fetches the list of new Extensions for the CMS Typo3 (www.typo3.org) and stores them in a database. Whenever somebody requests the RSS Feed the Feed XML is generated out of the database.
2
4294
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 mentions \f but illustrates no way write it to a text file. Thanks
6
2370
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 file to track how many times our feed was accessed? Just to get a rough idea how manyh subscribers we have? Not sure if copying and pasting a javascript into the XML source would work.
4
4231
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
2436
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. Here's why I "think" I want to use an RSS feed, and what I'm confused about. I have one file (and one file only) on my web site that changes
1
1649
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 category will probably have several new listings every hour. What's generally the recommended update frequency for an RSS feed? Also, in each update, do you exclude content that was in previous feeds, or do you leave it up to the reader to sort out...
4
1955
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
2385
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 replaced by the name of the function I'm trying to use. my article function when ran, comes up with "article is not defined" etc. Here's my code: What is wrong with it? #!/usr/bin/env python import ftplib import getpass def mainfeed(): ...
2
3231
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 it....///// // feed // // LOADS THE RSS FEED FOR // LOOPS THROUGH AND FORMATS/FILTERS POSTS // PULLS THE TIMESTAMP OF THE LATEST UPDATE FROM THE DB // IF THERE ARE NEW POSTS, ADD THEM TO THE DATABASE ///// public function feed($feed,$type) { if...
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9378
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10137
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9927
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5268
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.