Sunday, July 27, 2008

Re: [GENERAL] procedure to load xml file data in postgesql

On Sat, Jul 26, 2008 at 02:32:05PM -0700,
aravind chandu <avin_friends@yahoo.com> wrote
a message of 149 lines which said:

> I have to load xml file data into postgresql database
> table using a stored procedure,but I didn't have any
> idea how to start it.

Well, the problem is much too open to provide any ready-to-use
solution. The way you describe it, it looks like a school
assignment. Is it so?

First, you need to decide what the XML data will look like in
PostgreSQL:

* you can slurp the entire file in a TEXT field (the simplest
solution),

* you can convert it to relational data (the schema conversion is not
obvious because XML data model is hierarchical, not relational, but
this solution will give you "nice" SQL data; your actual data look
quite tabular and therefore will fit well in a relational schema)

* you can use PostgreSQL native XML facilities (I cannot help, I've
never used them).
<http://developer.postgresql.org/pgdocs/postgres/datatype-xml.html>
and <http://developer.postgresql.org/pgdocs/postgres/functions-xml.html>

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

No comments: