Feed validation problem

Feb 2, 2008
Reaction score
I am having problems with validating this feed


I'm not much of an xml expert so any help is appreciated. My main thing is a am trying to bring this feed into Feedburner, but it need to validate to do that

Here is the code

$start = 0;
$limit = 20;

$query = "SELECT title, url, item_title, item_date, item_url, item_text FROM feed_item left join
	feed_list on feed_item.item_fk = feed_list.id 
	where item_date <= NOW()
	order by item_date desc
	LIMIT $start, $limit";
	$result = mysql_query($query);
function unhtmlspecialchars( $string )
   	   //$string = preg_replace("/[^a-zA-Z0-9s]/", "", $string);
       $string = str_replace ( '&','&', $string );
       //$string = str_replace ( '\'','&apos;', $string );
       $string = str_replace ( '\"','&quot;',  $string );
       $string = str_replace ( '<','&lt;',  $string );
       $string = str_replace ( '>','&gt;',  $string );

       return $string;

echo "<?xml version='1.0' encoding='utf-8' ?>\n";
echo "<rss version='2.0'>\n";
echo "<channel>\n";
echo "<title>BlogHighEd.org</title>\n";
echo "<link>http://www.bloghighed.org/</link>\n";
echo "<description>A blogging network for higher ed bloggers.</description>\n

	while($item = mysql_fetch_array($result)){
		if($item['title'] != 'HighEd Channel'){
		echo  "\n<item>\n";
		echo  "<title>" . unhtmlspecialchars($item['title']) . ' - ' . unhtmlspecialchars(str_replace("?","",$item['item_title'])) . "</title>\n";
		echo  "<description>" . unhtmlspecialchars(str_replace("?","",substr($item['item_text'],0,255))); if(strlen($item['item_text']) >= 255) echo "..."; echo "</description>\n";
		echo  "<link>" . unhtmlspecialchars($item['item_url']) . "</link>\n";
		echo  "<pubDate>" . $item['item_date'] . "</pubDate>\n";
		echo  "</item>\n"; 

echo "</channel>\n";
echo "</rss>\n";


Any help is greatly appreciated.


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