HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


[RESOLVED] RSS Parse Anomoly

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#70591 (In Topic #14921)
Avatar

Community saint

Not sure if anything can and/or should be done about this as it's clearly something different with the feed and not ocPortal but I figured I'd report it anyway. I'm trying to add a feed that has no pub_date field:

Code

<?xml version="1.0" encoding="UTF-8"?><rss version="2.0">
<channel>
<title>News Feed - The Hill Times - Canada's Politics and Government Newsweekly</title>
<link>http://www.hilltimes.com</link>
<description>Canada's Politics and Government Newsweekly</description>
<language>en-ca</language>
<lastBuildDate>Wed, 25 Apr 2007 16:56:56 GMT</lastBuildDate>
<copyright>Copyright: (C) 2011 Hill Times Publishing Inc. All rights reserved. Unauthorized distribution, transmission or republication strictly prohibited.</copyright>
<item>
   <title>AG's report 'beyond reproach' says AFN chief, time for PM Harper's Cabinet to make moves</title>
   <link>http://hilltimes.com/page/view/firstnations-06-13-2011</link>
   <description><![CDATA[AFN National Chief Shawn Atleo calls on government to take advantage of majority status and directly address structural barriers to improving conditions for First Nations peoples.]]></description>
</item>
Adding this feed produces:

Expand: Stack Trace Stack Trace



Last edit: by SoccerDad

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved

OCP V7 | Advocating monetary reform - FreeOurMoney

Need OCP friendly hosting? Look no further:
Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal.
Back to the top
 
Posted
Rating:
#70593
Avatar

Try this…

Attachment
» Download: side_rss.php (6 Kb, 94 downloads so far)


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#70600
Avatar

Community saint

That's the ticket Chris. As always, thanks kindly!

An FYI: while I have to watch the feed for a bit, this appears to have fixed another issue that as best as I can tell, if the description field is blank or the description tag is on a new line, the xml parser fails with an error. It could be coincidental as there is lots of activity on this particular feed and the failing entry may have dropped off from this morning.

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved

OCP V7 | Advocating monetary reform - FreeOurMoney

Need OCP friendly hosting? Look no further:
Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal.
Back to the top
 
Posted
Rating:
#70601
Avatar

Coincidence. All I did here was workaround PHP's unusual operator precedence by adding an extra '()' set.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#70605
Avatar

Community saint

Thanks Chris. I'll watch the other feed and if the error reappears I'll post a note with as many clues as I can find. It's definitely related to specific item(s) as the error line number changes (line number increases, logical) as items are added to the feed list.

Very low priority issue for sure….

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved

OCP V7 | Advocating monetary reform - FreeOurMoney

Need OCP friendly hosting? Look no further:
Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal.
Back to the top
 
Posted
Rating:
#70681
Avatar

Community saint

The second problematic feed has produced the error this morning:

Code

XML error when parsing RSS/Atom stream: Invalid character at line 40

XML up to line 40:

Code

<?xml version="1.0" encoding="windows-1252"?>
<rss version="2.0">
    <channel>
        <title>GlobalResearch.ca</title>
      <description>GlobalResearch.ca Articles</description>
      <link>http://www.globalresearch.ca</link>
      <language>en-us</language>

      <lastBuildDate>Sat, 02 Jul 2011 14:20:00 -0400</lastBuildDate>
      <pubDate>Sat, 02 Jul 2011 14:20:00 -0400</pubDate>

      <generator>GlobalResearch.ca</generator>

      <item>
         <title>The Greatest Depression Has Only Begun</title>
         <description>Originating in 2008, the global economic crisis took the world by storm: banks collapsed, the &quot;too big to fail&quot; became bigger... </description>
         <link>http://www.globalresearch.ca/index.php?context=viewArticle&amp;code=RES20110602&amp;articleId=25089</link>
         <pubDate>Sat, 02 Jul 2011 14:20:00 -0400</pubDate>
         <guid isPermaLink="false">RES20110602-25089</guid>
      </item>
      <item>
         <title>US steps up ties with Syrian insurgents </title>
         <description>For more details, please click on the link to read the article.</description>
         <link>http://www.globalresearch.ca/index.php?context=viewArticle&amp;code=20110617&amp;articleId=25310</link>
         <pubDate>Fri, 17 Jun 2011 21:02:00 -0400</pubDate>
         <guid isPermaLink="false">20110617-25310</guid>
      </item>
      <item>
         <title>Seeds of Destruction: The Diabolical World of Genetic Manipulation</title>
         <description>For more details, please click on the link to read the article.</description>
         <link>http://www.globalresearch.ca/index.php?context=viewArticle&amp;code=ENG20110617&amp;articleId=25303</link>
         <pubDate>Fri, 17 Jun 2011 15:08:00 -0400</pubDate>
         <guid isPermaLink="false">ENG20110617-25303</guid>
      </item>
      <item>
         <title>The Globalization of &quot;Fast Food&quot;. Behind the Brand: McDonald's</title>
         <description>For more details, please click on the link to read the article.</description>
         <link>http://www.globalresearch.ca/index.php?context=viewArticle&amp;code=SAL20110616&amp;articleId=25309</link>
         <pubDate>Thu, 16 Jun 2011 19:28:00 -0400</pubDate>
         <guid isPermaLink="false">SAL20110616-25309</guid>

Being a little XML challenged, not sure if blank lines are skipped or included in the line count. My amateur eyes notice only one possibility which is the apostrophe in the word McDonald's…oh, and the fact that the encoding is windows lol.

Again, low priority on this one, no biggie….

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved

OCP V7 | Advocating monetary reform - FreeOurMoney

Need OCP friendly hosting? Look no further:
Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal.
Back to the top
 
Posted
Rating:
#70683
Avatar

Saved as a local feed (finished off the XML tags) and it displayed okay. This forum might have changed the code. If you could zip and attach the whole non-functioning RSS feed it would help.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#70684
Avatar

Community saint

Tip - Most, if not all, browsers will validate an XML file and show you exactly where the error is. Just save the XML file and open it with your browser.

Also, here is an online RSS analyser that I have found to be very useful: | Feed Analyzer (RSS/ATOM/RDF) by Michael P. Shipley

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#70685
Avatar

Community saint

This is a strange one indeed. Saving the file as XML displays the content no probleemo. Of course, go figure, no articles added to the feed since this morning to track the line number down the list.

@temp1024: I can't seem to get this to fail when using an RSS reader, the feed reader in Claws Mail or FF RSS display. Viewing the file as presented on the website (with php extension) also seems to work fine. Thanks for the feed analyzer link, kewl tool! Interestingly, it too shows all is well:
Feed Level Data
Effective Feed URL: GlobalResearch.ca
Description: GlobalResearch.ca Articles
Copyright: none
Image: none
Latitude/Longitude: none
Dates: Feed items have dates

Title: GlobalResearch.ca
Link: GlobalResearch.ca - Centre for Research on Globalization
Feed Type: RSS
Language: en-us
Encoding: UTF-8
Author: none
Number of items: 30
Do posts have excerpts? yes
Do posts have full text? no
Posts are made on average every 14 hours 12 minutes
The oldest post is: 2 days 14 hours 50 minutes old.
(Cache duration should be no longer than this or items may be missed.)
Are posts sorted by date?: Yes, in reverse chronological order


Attachment
» Download: rss.php (13 Kb, 95 downloads so far)

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved

OCP V7 | Advocating monetary reform - FreeOurMoney

Need OCP friendly hosting? Look no further:
Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal.
Back to the top
 
Posted
Rating:
#70687
Avatar

Fixed. The windows charset is invalid so it reverts to UTF but is not interpretable as that. Now it recognises windows-1252 as ISO-8859-1.

Attachment
sources/rss.php
» Download: rss.php (24 Kb, 73 downloads so far)


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#70688
Avatar

Community saint

That was it, displaying nicely now. Thanks again Chris!

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved

OCP V7 | Advocating monetary reform - FreeOurMoney

Need OCP friendly hosting? Look no further:
Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal.
Back to the top
 
Posted
Rating:
#70689
Avatar

Community saint

SoccerDad said

… and the fact that the encoding is windows …

Chris Graham said

Fixed. The windows charset is invalid so it reverts to UTF …

Good 'spot' SD!

 :thumbs:

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: