Re: XML question

From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tony Grant <tony(at)animaproductions(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: XML question
Date: 2001-06-05 19:30:23
Message-ID: m3u21u3esw.fsf@dep1.fciencias.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:

> Tony Grant writes:
>
> > - what is the _most popular_ way of storing XML data in posgresql?
> >
> > - what is the _best_ way of stocking XML data in postgresql?
>
> 'text' is probably the only possible and reasonable answer to either of
> these (except for 'varchar').

I'm using xml-schema to specify my schema, postgreSQL to store the
data and some scripts to do the translation. The idea is: every
element that may appear in the document is stored in a table which has
the same attributes as the element, ie if you have the definition of
the element as follows:

<complexType name="student">
<attribute name="id" type="xs:integer"/>
<attribute name="name" type="xs:normalizedString"/>
</complexType>

it will be mapped into postgres as:

create table student
(
id primary key,
name text
);

so, when I read an element of the form:

<student id="10" name="masm"/>

it is stored into postgres using something like:

insert into student (id,name) values (10,xs_normalize('masm'));

Ok, this may get more complex when you use sequence's inside the
element definition, but it is done using references. This
idea may not work with mixed content, or complex documents as html,
but it does work for me :-)

hth,
Manuel.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-06-05 20:13:36 Re: Calling external programs
Previous Message Tauren Mills 2001-06-05 19:30:03 RE: Limiting simultaneous connections