Karem
Karem

Reputation: 18103

Is this outputting correct RSS XML?

See this page,

Why doesnt it show like it does when you enter a .xml file?

Or should it not do. When i look in ctrl+u for source, it looks correct.

I have this in my php file at the top:

<?php
header("Content-Type: application/rss+xml; charset=utf-8");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><rss version=\"2.0\">";
?>

I want <title> to be a element, not a html tag, which the browser thinks it is.

Upvotes: 1

Views: 2501

Answers (2)

Rana Pratap Singh
Rana Pratap Singh

Reputation: 867

Remove <?php echo "<?xml version='1.0' encoding='UTF-8'?>"; ?> from your view. I was getting following error :-

This page contains the following errors:

error on line 2 at column 6: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error.

I was using Codeigniter. simply remove echo "<?xml version='1.0' encoding='UTF-8' from your. Surely it will work.

Upvotes: 0

Quentin
Quentin

Reputation: 943556

It has several errors. Use a validator.

The basic problem is that this doesn't appear to have much resemblance to RSS at all (lacking, for instance, any <item>s).

For whatever reason, header("Content-Type: application/rss+xml; charset=utf-8"); is not being respected either. The server is claiming that it is an HTML document.

Upvotes: 1

Related Questions