Re: XML -> PG ?

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: XML -> PG ?
Date: 2009-05-06 15:40:40
Message-ID: 482E80323A35A54498B8B70FF2B879800400FFD347@azsmsx504.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Maybe...

<ALL>
<EMPLOYEES>
<EMP EMP_NAME="JOE" JOB="CARPENTER" />
EMP EMP_NAME="FRANK" JOB="PLUMBER"/>
EMP EMP_NAME="SUE" JOB="CARPENTER"/>
</EMPLOYEES>
<JOBS>
<JOB JOB_NAME="CARPENTER" SALARY=25.50 />
<JOB JOB_NAME="PLUMBER" SALARY=28.75 />
</JOBS>
</ALL>

...equals...

create table employees (emp_name varchar[64], job varchar[64]);
create table jobs (job_name varchar[64], salary float);
insert into employees (emp_name,job) values ('JOE','CARPENTER');
insert into employees (emp_name,job) values ('FRANK','PLUMBER');
insert into employees (emp_name,job) values ('SUE','CARPENTER');
insert into jobs (job_name,salary) values ("CARPENTER",25.50);
insert into jobs (job_name,salary) values ("PLUMBER",28.75);

After that, it's up to the user to understand that employees.job = jobs.job_name and index appropriately.

-----Original Message-----
From: Merlin Moncure [mailto:mmoncure(at)gmail(dot)com]
Sent: Wednesday, May 06, 2009 11:23 AM
To: Gauthier, Dave
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] XML -> PG ?

On Wed, May 6, 2009 at 10:47 AM, Gauthier, Dave <dave(dot)gauthier(at)intel(dot)com> wrote:
> Is there a way to read an XML file into a postgres DB?  I'm thinking that it
> will create and relate whatever tables are necessary to reflect whatever's
> implied by the XML file structure.

since xml is basically completely unstructured, you are not giving
enough information about what you'd like to do. that said, be sure and
check out the pg xml extensions...

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joao Ferreira gmail 2009-05-06 15:53:56 Re: XML -> PG ?
Previous Message JP Fletcher 2009-05-06 15:39:57 prepared statements and DBD::Pg