Re: RSS SQL tables
- From: croora <croora@xxxxxx>
- Date: Tue, 14 Apr 2009 14:34:56 +0200
Jasen Betts wrote:
On 2009-04-14, croora <croora@xxxxxx> wrote:
Erwin Moller wrote:
croora schreef:
I like to store all RSS 2.0 elements in db with php. I try to design
optimal database structure.
Is there some recommended structure or something?
Well, common sense?
Define all the elements (attributes) you want to store.
Create a table that holds that information.
Use a serial (autonumber) primary key in that same table to identify
each record.
Regards,
Erwin Moller
tnx
i know that it looks simple, but it isn't :)
in RSS specification, some tags has own attributes and another nested
tags (etc. <enclosure> has attributes, <image> has 3 nested elements).
xml does not translate well to a relational database.
you might try something liek this.
CREATE TABLE xmlnode (
id serial PRIMARY KEY,
nodename TEXT,
parentnode integer references xmlnode(id) ON DELETE CASCADE,
textvalue TEXT
)
CREATE TABLE xmlattribute
{
node integer REFERENCES node(id) ON DELETE CASCADE,
attrnum INTGER,
attributename TEXT,
atrtribute TEXT,
PRIMARY KEY (node,attrnum)
}
but I can't see it being very useful.
why do you wish to represent the XML as relations, what sort of
manipulations do you plan to do on it using SQL?
I would be inclined to put entire articles into TEXT fields,
i try to store misc RSS feeds in database, manipulate them and then restore
RSS again (mysql+php).
does have sence doing something like that? or it is waist of time?
i don't know, maybe i return to one TEXT field and XML parser :(
tnx on any advice
.
- Follow-Ups:
- Re: RSS SQL tables
- From: Jasen Betts
- Re: RSS SQL tables
- References:
- Re: RSS SQL tables
- From: Erwin Moller
- Re: RSS SQL tables
- From: croora
- Re: RSS SQL tables
- From: Jasen Betts
- Re: RSS SQL tables
- Prev by Date: Re: RSS SQL tables
- Next by Date: Re: RSS SQL tables
- Previous by thread: Re: RSS SQL tables
- Next by thread: Re: RSS SQL tables
- Index(es):
Relevant Pages
|