Jump to content

Problem Changing Rss Into Atom Reader


rash799
 Share

Recommended Posts

Hi I am looking at the rss reader tutorial given on the w3schools website: http://www.w3schools.com/php/php_ajax_rss_reader.asp I am trying to make it work on atom feeds but it is showing the following error: Warning: DOMDocument::load() [function.load]: Opening and ending tag mismatch: link line 4 and head in http://creditwrench.blogspot.com/atom.xml, line: 12 in /web/rkhan19/ftpaccess/pub/w3_rss/Atom/getrss.php on line 8 Warning: DOMDocument::load() [function.load]: Opening and ending tag mismatch: img line 13 and a in http://creditwrench.blogspot.com/atom.xml, line: 13 in /web/rkhan19/ftpaccess/pub/w3_rss/Atom/getrss.php on line 8 Warning: DOMDocument::load() [function.load]: Opening and ending tag mismatch: a line 13 and div in http://creditwrench.blogspot.com/atom.xml, line: 15 in /web/rkhan19/ftpaccess/pub/w3_rss/Atom/getrss.php on line 8 .........................this error occurs several time and it also shows the following 2 errors...................... Warning: DOMDocument::load() [function.load]: Entity 'copy' not defined in http://creditwrench.blogspot.com/atom.xml, line: 51 in /web/rkhan19/ftpaccess/pub/w3_rss/Atom/getrss.php on line 8Warning: DOMDocument::load() [function.load]: Entity 'ndash' not defined in http://creditwrench.blogspot.com/atom.xml, line: 51 in /web/rkhan19/ftpaccess/pub/w3_rss/Atom/getrss.php on line 8 Can anyone help me?? Below is the code that I am using: <?php $xml = "http://creditwrench.blogspot.com/atom.xml";$xmlDoc = new DOMDocument();$xmlDoc->load($xml); $channel=$xmlDoc->getElementsByTagName('entry')->item(0);$channel_title = $channel->getElementsByTagName('title')->item(0)->childNodes->item(0)->nodeValue;echo($channel_title . "</p>");?>

Link to comment
Share on other sites

It sounds like you have malformed XML in your document.Aside from that, the entities &copy; and &ndash; are only part of the HTML DTD and aren't used in Atom. You'll have to use the Unicode character number instead.&copy; to 169;&ndash; to 8211;

Link to comment
Share on other sites

Thanks for the advice ingolme

It sounds like you have malformed XML in your document.
Do you mean there is an error in the atom feed or an error in the coding?? If it is in the coding then all I want to display is the information in the <title> tag (for this test anyway). Do you have any suggestions on what I could be doing wrong??
Aside from that, the entities © and – are only part of the HTML DTD and aren't used in Atom. You'll have to use the Unicode character number instead.© to ©– to –
hmmm thanks for the advice I will need to look into this.
Link to comment
Share on other sites

PHP says there are mismatching tags. That means that the error is in the XML document.You should make sure that no <, > or & characters are placed around the document, and make sure that you open and close all your tags properly and in the correct order.

Link to comment
Share on other sites

Thanks for the help Ingolme

PHP says there are mismatching tags. That means that the error is in the XML document.You should make sure that no <, > or & characters are placed around the document, and make sure that you open and close all your tags properly and in the correct order.
I think what you meant is that there is a problem with the document that the url is getting so I tried this url on feed bucket which is supposed to work atom feeds and it displayed an error as well so I dont think taht there is an erro in the code. Does anyone have an atom url which works?? its easy to find an rss url but hard to find an atom one.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...