[nycphp-talk] XML Manipulation
Ben Sgro (ProjectSkyLine)
ben at projectskyline.com
Thu Aug 16 11:01:13 EDT 2007
Hey, thanks alot.
I'm going to print this out and give it a thorough read.
I'm sure your correct, as I have minimal experiance in this. I take a look
at the POC as well.
Ben Sgro, Chief Engineer
ProjectSkyLine - Defining New Horizons
----- Original Message -----
From: "Dan Cech" <dcech at phpwerx.net>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Thursday, August 16, 2007 10:53 AM
Subject: Re: [nycphp-talk] XML Manipulation
> Ben Sgro (ProjectSkyLine) wrote:
>> Hello all,
>> After the XML vs SQL conversation, I started to rethink a product I'm
>> working on.
>> I had been having a lot of trouble modeling the data into SQL. It was
>> starting to
>> look very complicated.
>> So, I decided I would try to store it in XML. The data I am storing is
>> messages w/in a thread,
>> timestamp, body and subject. On the SQL side, we create a table that has
>> the user id,
>> and a row per message/thread which contains a path to the xml file.
>> The reason XML seemed better is that I store the data top down and that
>> is the true
>> order of the thread. Messages within the thread can come from email or
>> html page response,
>> so its important to insert items into the thread via the timestamp. Using
>> XML just made it
>> simpler for me to wrap my head around, than trying to model it in SQL.
> This sounds awfully messy to me, and will most likely be very slow.
> I'm all for XML, but this kind of thing is what databases are meant for.
> All you need are 2 tables, one for each thread and one for messages.
> SELECT * FROM threads ORDER BY activity DESC
> SELECT * FROM messages WHERE thread_id=? ORDER BY ts ASC
> Couldn't be easier, if you want to store extra data about each thread or
> message just add fields to the relevant table.
> I just wrapped up a complete rewrite of a system that used one table for
> threads and messages, and I would strongly suggest advise against it.
> If you're looking for ideas, here is a proof-of-concept I put together
> back in 2004 for a system using a modified preorder traversal tree for
> threaded messages.
> New York PHP Community Talk Mailing List
> NYPHPCon 2006 Presentations Online
> Show Your Participation in New York PHP
More information about the talk