XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 19th, 2004, 09:48 PM
Culland Culland is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 38 Culland User rank is Private First Class (20 - 50 Reputation Level)Culland User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 55 m 6 sec
Reputation Power: 6
Best way to programmatically add to an RSS Feed?

I have my RSS done, happy with the results. However I build my RSS programatically and I want it to maintain itself via a chron job I have setup.

Using PHP whats the best way to maintain the RSS feed?

The problem as I see it is that new articles are at the top of the <item> lists, which PHP wont let me just add in, so I have to read in the entire file, insert my new <item> and then re-write the entire file. This is fine for a few entries, but seems a pain if my feed gets to any length.

I was sorta kicking the DOMXML functions around, but looks like the same idea, I have to write the entire XML file to memory, then output it again with any additional nodes I want.

So whats my best bet here? Suggestions?

Cul

Reply With Quote
  #2  
Old January 21st, 2004, 02:10 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
You're pretty much stuck there. Unless you know the exact byte in the file where you want to insert the new data you pretty much have to read it all into memory.

On the plus side, you're worrying over nothing. Assuming you're meaning for people to actually be able to download your RSS file the size is going to be plenty small enough that reading/modifying/writing will be quite snappy.

You could also take the approach of dynamically generating the RSS when someone requests it. I'd recommend the other approach, though. Unless you're writing new articles every few minutes it's probably better to have a static file.

Reply With Quote
  #3  
Old January 21st, 2004, 10:59 AM
Culland Culland is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 38 Culland User rank is Private First Class (20 - 50 Reputation Level)Culland User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 55 m 6 sec
Reputation Power: 6
Thanks for the reply. I have sorta been thinking of doing both approaches. Put the most recent items as a static file, thus letting me keep it fairly small, and have all entries in my mysql database that I can dynamically generate an RSS for on a users request for people that want older references.

Its a way forward at any rate If I did know the exact byte that I wanted to insert data into the file, how would I go about doing that?

Cul

Reply With Quote
  #4  
Old January 21st, 2004, 11:25 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Google around for "fixed length record". It's not too terribly simple. Here are a few references: http://www.cs.sfu.ca/CC/354/zaiane/...r10/node15.html
http://iis1.cps.unizar.es/Oreilly/p...ook/ch08_16.htm

Reply With Quote
  #5  
Old January 21st, 2004, 12:28 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Also look for "random access file". You'll need both techniques, and this one is probably the better place to start, actually.

Here's a description: http://webster.cs.ucr.edu/Page_AoAL...TML/Files3.html

Here's some info on using php:
http://www.mail-archive.com/php-win...t/msg17555.html

It's going to be a challenge to do this with xml data, though.

Reply With Quote
  #6  
Old January 21st, 2004, 12:49 PM
Culland Culland is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 38 Culland User rank is Private First Class (20 - 50 Reputation Level)Culland User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 55 m 6 sec
Reputation Power: 6
Ok thanks, I will do some reading!

Cul

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Best way to programmatically add to an RSS Feed?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT