NYCPHP Meetup

NYPHP.org

[nycphp-talk] Database vs. XML

Jim Hendricks jim at bizcomputinginc.com
Tue Jul 16 11:32:04 EDT 2002


The advantage of using XML between the database and the presentation ( HTML
etc. ) is that you have your data from your query in an organized fashion
that can be used and manipulated beyond just the web page.  For example, I
don't bother buying a TV guide anymore, I just check www.tvguide.com and get
my local listings.  I really want to get my local listings on my Palm, but I
don't like the options available.  So I being a programmer decided to rip
what's on the tvguide site, format it the way I want then put it on my Palm.
Well, their site is a complex combo of HTML and javascript.  Parsing will be
complicated.  And then, what if they change the page slightly which breaks
my parser?

Here XML comes to the rescue.  If they delivered the data portion of the
page as XML, I can forget about parsing the HTML looking for what I want, I
can go directly to the XML & parse it.  And if they change the XML, I have a
good chance my parser will still work so long as the fields I am looking for
are still there.

There are also those who claim that use of XML and XSLT lead to more
consistent pages with better organized code and quicker development time.  I
being a long time HTML coder feel comfortable enough with what I can do in
HTML that I don't care to learn the XSLT.  I can code quickly enough,
consistent enough, and organized enough for me!

Jim

----- Original Message -----
From: "Oktay Altunergil" <nyphp at altunergil.com>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Tuesday, July 16, 2002 11:15 AM
Subject: Re: [nycphp-talk] Database vs. XML


> Sure.. You can either display the data dynamically on the fly..(this is
pretty much what everybody else is doing) Or save it as html to display
later. I said you could *still* use XML because you mentioned it.
>
> Oktay
>
> On Tue, 16 Jul 2002 11:03:38 -0400
> bruce at mtiglobal.com wrote:
>
> > Thanks for the responses.
> >
> > But if I'm storing data in a database then why not skip xml and output
the
> > data to a text file and save as html where I'm outputting the recordset
one
> > by one using something like:
> >
> > x = "<p>" + productID + "</br>"
> >
> > where productId is the record from the recordset I'm looping through and
> > any transformation is done in the sql statement used to open the
recordset?
> >
> > > How would you store the XML? Flat files? In that case I think you're
> > > going to find that approach a little slow. Relational databases have a
> > > lot of advantages.
> > >
> > > There's nothing mutually exclusive about using a database AND XML. You
> > > ideally could store your data in a properly normalized database, write
> > > object-oriented PHP to query it, generate well-formed XML from the
> > > query results, and fold in XSLT to emit HTML.
> > >
> > > There are even databases out there that claim to store data natively
in
> > > XML (some of which support query languages with better grammar than
> > > SQL). Searching for "Open-source XML database" on Google:
> > >
> > > http://www.rpbourret.com/xml/XMLDatabaseProds.htm
> > >
> > > http://exist.sourceforge.net/
> > >
> > > http://www.xmlhack.com/read.php?item=1345
> > >
> > > Eliot
> > >
> > > ----- Original Message -----
> > > From: <bruce at mtiglobal.com>
> > > To: "NYPHP Talk" <talk at nyphp.org>
> > > Sent: Tuesday, July 16, 2002 9:24 AM
> > > Subject: [nycphp-talk] Database vs. XML
> > >
> > >
> > >> Hi!
> > >>
> > >> I've been asking a number of people this question but haven't
received
> > > a
> > >> satisfactory answer, so was wondering if anyone here can help.
> > >>
> > >> Both a database (such as MySQL) and XML can be used for storing,
> > >> manipulating (XML w/ XSLT), rendering data.
> > >>
> > >> How does one decide between the two?
> > >>
> > >> One scenario I might be dealing with soon is taking product
> > > information
> > >> from a DOS system and throwing it out to either MySQL or XML for
> > > posting on
> > >> a web site.
> > >>
> > >> Thanks.
> > >>
> > >> - Bruce
> >
> >
> >
> >
>
>
>
>





More information about the talk mailing list