Jump to content

Merging XML feeds and sorting chronologicly


maexus

Recommended Posts

Ok, so I have 3 xml feeds.  To make things simple, lets say they are ATOM feeds. Not that it matters. These feeds come from 3 different sources so they contain 3 different kinds of data. The data isn't important either. What is important is the timestamp of these entries.

 

What I want to do is merge all the entries from all 3 of the feeds and then sort them chronologically using the entry timestamps. This stream of entries would be available for public viewing so I need a way to keep the resources down.

 

Now, I have thought about this and really I'm just asking for advice, not an answer. My first thought  was to parse one feed at a time, putting all the data into the array then sorting the array via the timestamps. This would be done in real time every time there was a refresh, which can tax some servers unless I cached the feeds.

 

The same thing could be done with a database but that would mean I would need to setup a cronjob to monitor the feeds so the stream is nice and updated when someone visits. This would work except my host only allows 30 minute incremental cron jobs.

 

Done reading all that? Good. Here is my questions in condensed form

 

1) What, in your opinion, is the best way to merge and sort the data

2) Do you think the array or the database is the best approach. Or do you think it's all rubbish and have a 3rd suggestion?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.