NYCPHP Meetup

NYPHP.org

[nycphp-talk] Amazing New Framework!

David Mintz dmintz at davidmintz.org
Wed Feb 11 17:59:16 EST 2004


Sounds like they should partner up with Vernon T. Bludgeon Consulting --
http://vernontbludgeon.com/


---
David Mintz
http://davidmintz.org/

        "Anybody else got a problem with Webistics?" -- Sopranos 24:17

>From hans not junk at nyphp.com  Wed Feb 11 18:00:50 2004
Return-Path: <hans not junk at nyphp.com>
Received: from ehost011-1.exch011.intermedia.net (unknown [64.78.21.3])
	by virtu.nyphp.org (Postfix) with ESMTP id 1737AA85E9
	for <talk at lists.nyphp.org>; Wed, 11 Feb 2004 18:00:50 -0500 (EST)
X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Subject: RE: [nycphp-talk] Translating XML to SQL
Date: Wed, 11 Feb 2004 15:00:48 -0800
Message-ID: <41EE526EC2D3C74286415780D3BA9F877729B1 at ehost011-1.exch011.intermedia.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: [nycphp-talk] Translating XML to SQL
Thread-Index: AcPw8E+a+kWaU0GsShqcTEbQnh0hVgAAmhOA
From: "Hans Zaunere" <hans not junk at nyphp.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
X-BeenThere: talk at lists.nyphp.org
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: NYPHP Talk <talk at lists.nyphp.org>
List-Id: NYPHP Talk  <talk.lists.nyphp.org>
List-Unsubscribe: <http://lists.nyphp.org/mailman/listinfo/talk>,
	<mailto:talk-request at lists.nyphp.org?subject=unsubscribe>
List-Archive: <http://lists.nyphp.org/pipermail/talk>
List-Post: <mailto:talk at lists.nyphp.org>
List-Help: <mailto:talk-request at lists.nyphp.org?subject=help>
List-Subscribe: <http://lists.nyphp.org/mailman/listinfo/talk>,
	<mailto:talk-request at lists.nyphp.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Feb 2004 23:00:50 -0000


This is interesting, Eric.  If you write your emails anywhere as =
complete as you'd write an article, this might make a good Advanced =
PHundamentals  :)

H=20

> -----Original Message-----
> From: talk-bounces at lists.nyphp.org=20
> [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Eric Rank
> Sent: Wednesday, February 11, 2004 5:40 PM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] Translating XML to SQL
>=20
> Thanks for your suggestions Dan (other Dan too). I should=20
> apologize for
> being a little vague in my previous post about the details of=20
> the project
> I'm working on. I mainly wanted to see if any of y'all had=20
> faced similar
> XML->SQL challenges and if there might be packaged solution=20
> was out there to
> solve it.
>=20
> Parsing the XML and encapsulating it into objects is the easy=20
> part in this
> project. It's trying to unpack it all that gets a little screwy.
>=20
> My solution is to do the following:
>=20
> 1. First parse the XML content into a multidimensional array=20
> that reflects
> the xml structure (After thinking about it, this should=20
> probably be a more
> structured object)
> 2. Create a database object to encapsulate the database structure
> 3. parse an xml formatted ruleset file into an object that=20
> will determine
> how to execute sql statements.
>=20
> This ruleset object is the key to making the whole thing come=20
> together.
> Essentially, it does the same thing as a stored procedure would. The
> likeness is obvious now that you bring up the topic. I hadn't=20
> thought of
> that before. Basically, this creates a 'rule' for each table, and
> contigencies for the columns and tables as needed. This also=20
> serves as a
> place to map out the relationship between an xml file and a database
> structure. The cool thing is that I should be able to take=20
> just about any
> database & XML pair, create a ruleset file defining the=20
> relationships &
> contigencies, and it should all work. Although a new xml=20
> parser would need
> to be created for the xml file holding the data in order to create the
> multidimensional struct the translator object expects.
>=20
> Right now, I'm to the point where:
> 1. I'm looping through the list of tables from the database object
>     1.1 checking the rules for that table
>         1.1.1 if the rule passes, the insert query happens and returns
>                 success
>         1.1.2 if the rule does NOT pass, i need to look at a=20
> different table
>                 so i go through the process recursively.=20
> checking table
> rules,
>                 inserting where possible until all records=20
> have been saved,
>                 or, at this point, ad infinitum
>=20
> I can insert data, and to a certain degree it gets inserted=20
> correctly, but
> I'm winding up with some corruption of data, which I'm trying=20
> to pin down.
> Infinite loops are happening right now... Recursion is cool=20
> when it works. I
> kind of feel like I'm working magic when it happens, but=20
> until that magical
> point, it's fairly hair raising.
>=20
>=20
>=20
>=20
> ----- Original Message -----=20
> From: "Dan Cech" <dcech at phpwerx.net>
> To: "NYPHP Talk" <talk at lists.nyphp.org>
> Sent: Wednesday, February 11, 2004 1:13 PM
> Subject: Re: [nycphp-talk] Translating XML to SQL
>=20
>=20
> > From the work I've done on adodb-xmlschema, I would advise an object
> > oriented approach, it really helps to break up the logic.
> >
> > I would create a class to hold the methods for parsing a=20
> document, etc,
> > and another class to represent an article.
> >
> > Once you have a class for the article you can build up all=20
> the article
> > details from the xml, and finally generate and run the SQL=20
> to insert all
> > the required records.  You could also use the class for=20
> accessing the
> > data once it is in the database....
> >
> > You may also want to create classes for author, etc which=20
> could handle
> > the logic for updating/inserting the relevant details into=20
> those tables.
> >
> > Anyway, it appears you are looking at a procedural solution=20
> right now,
> > which will work too....honestly I'd have to have more=20
> details about the
> > specific issues you are working around in order to give you=20
> any concrete
> > advice.
> >
> > Dan
> >
> > Eric Rank wrote:
> > > I'm working on a PHP app that will translate XML to SQL based on a
> > > configuration file with rules, and as I'm getting to the=20
> end of this
> > > project, all the quirks and airbubbles (yes, ok, they're BUGS) are
> > > getting squeezed out. And man, it's no fun. So now I'm looking for
> > > solutions that may have been created before me.
> > >
> > > Specifically, the xml contains information from articles=20
> in a newspaper.
> > > Author, issue, volumne, section, category, headline,=20
> story, etc. This
> > > xml we get from an export from QuarkXPress (which is its=20
> own nightmare)
> > >
> > > I'm trying to  take this xml structure that contains NO database
> > > specific information and place it into a MySQL database=20
> with about a
> > > dozen related tables. The trick is that in going through=20
> an xml file,
> > > there are a lot of contigencies to cover before finally=20
> reaching the
> > > database. For example, some INSERT statements require the=20
> inserted id of
> > > a previous insert statement in order to make the records=20
> relational (eg.
> > > we need to insert the 'story' info into the 'article'=20
> table to get the
> > > inserted id for the article, which then gets inserted=20
> into the 'photos'
> > > table in the 'articleID' column.). Some insert statements=20
> might not need
> > > to happen because the information already exists (eg. an=20
> author that
> > > already exists in the database). You get the idea.
> > >
> > > Anyone have experience doing this? Is there an open=20
> source project out
> > > there that's working on this? Third party software even?
> > >
> > > Thanks for your help,
> > >
> > > Eric Rank
> >
> > _______________________________________________
> > talk mailing list
> > talk at lists.nyphp.org
> > http://lists.nyphp.org/mailman/listinfo/talk
>=20
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>=20
>=20



More information about the talk mailing list