converting tables to XML and back

Started by shulkaeover 16 years ago4 messagesgeneral
Jump to latest
#1shulkae
shulkae@gmail.com

We have few tables which we would like to convert to XML and store it.

Another requirement is to convert the stored XML file back to the
original tables. This helps us to clone a system. I was thinking to
use Perl XML Simple module to generate XML files.

How do I again re-create tables from XML?

thanks
shul

#2Dimitri Fontaine
dimitri@2ndQuadrant.fr
In reply to: shulkae (#1)
Re: converting tables to XML and back

shulkae <shulkae@gmail.com> writes:

Another requirement is to convert the stored XML file back to the
original tables. This helps us to clone a system. I was thinking to
use Perl XML Simple module to generate XML files.

What about using pg_dump and pg_restore for the cloning, or maybe a
replication solution?

I don't know about your other needs for XML backups, but I'd prefer
pg_dump over them anytime.
--
dim

#3Sam Mason
sam@samason.me.uk
In reply to: shulkae (#1)
Re: converting tables to XML and back

On Mon, Jan 04, 2010 at 07:46:29AM -0800, shulkae wrote:

We have few tables which we would like to convert to XML and store it.

Not sure if you've seen them, but Postgres provides a few built in functions that will help with simple tasks:

http://www.postgresql.org/docs/current/static/functions-xml.html

Another requirement is to convert the stored XML file back to the
original tables. This helps us to clone a system. I was thinking to
use Perl XML Simple module to generate XML files.

Not tried to do this, but the functions from above should help.

How do I again re-create tables from XML?

xpath() is what I've used for this before. It's performance isn't
amazing, but it's been enough for the things I've used it for.

--
Sam http://samason.me.uk/

#4Scott Bailey
artacus@comcast.net
In reply to: shulkae (#1)
Re: converting tables to XML and back

shulkae wrote:

We have few tables which we would like to convert to XML and store it.

Another requirement is to convert the stored XML file back to the
original tables. This helps us to clone a system. I was thinking to
use Perl XML Simple module to generate XML files.

How do I again re-create tables from XML?

thanks
shul

Check out
http://developer.postgresql.org/index.php/XML_Support#Mapping_XML_Documents_to_SQL_Databases

Specifically the link to DBIx-XML-DataLoader