pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedExport to XML
3+ messages / 3 participants
[nested] [flat]
* Export to XML
@ 2005-11-11 18:26 Warren Murray <murray_warren@bah.com>
0 siblings, 2 replies; 3+ messages in thread
From: Warren Murray @ 2005-11-11 18:26 UTC (permalink / raw)
To: pgsql-sql
What is the process to export a PostgreSQL table to XML? How is it done?
Thanks!
Warren L Murray
Booz Allen Hamilton
Phone: 404.518.7940
Email: murray_warren@bah.com
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Export to XML
@ 2005-11-18 21:16 Dean Gibson (DB Administrator) <postgresql4@ultimeth.com>
parent: Warren Murray <murray_warren@bah.com>
1 sibling, 0 replies; 3+ messages in thread
From: Dean Gibson (DB Administrator) @ 2005-11-18 21:16 UTC (permalink / raw)
To: pgsql-sql
On 2005-11-11 10:26, Warren Murray wrote:
> What is the process to export a PostgreSQL table to XML? How is it done?
> Thanks!
>
Two ways using PSQL:
1. Select HTML output ("\H" command) and then do a very minor amount of
post processing (details left to the reader).
2. Select "expanded" output ("\x" command), and then use SED to
post-format the output into XML:
sed -r 's:^-\[ RECORD (.*) \]-+$:</row>\n<row number="\1">:;s:([^ ]*)
+\| (.*): <\1>\2</\1>:;s:^$:</row>:;1s:</row>\n::'
There's probably a cleaner way with AWK, but the above is simple enough
(your eMail reader may break the above into separate lines at the
positions where I had a space). The last two "s" commands just handle
the first/last line cases.
The only thing the above does not handle is NULL values as distinct from
zero-length strings.
-- Dean
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Export to XML
@ 2005-11-19 12:27 Nikolay Samokhvalov <samokhvalov@gmail.com>
parent: Warren Murray <murray_warren@bah.com>
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Samokhvalov @ 2005-11-19 12:27 UTC (permalink / raw)
To: Warren Murray <murray_warren@bah.com>; pgsql-sql
You can try to use this patch:
http://archives.postgresql.org/pgsql-patches/2005-09/msg00138.php
This is implementation of basic functions of SQL/XML (14th part of
SQL:2003, http://www.sqlx.org/)
I've successfully applied it to 8.1 version - no troubles.
On 11/11/05, Warren Murray <murray_warren@bah.com> wrote:
> What is the process to export a PostgreSQL table to XML? How is it done?
> Thanks!
>
> Warren L Murray
> Booz Allen Hamilton
> Phone: 404.518.7940
> Email: murray_warren@bah.com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
--
Best regards,
Nikolay
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-11-19 12:27 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-11-11 18:26 Export to XML Warren Murray <murray_warren@bah.com>
2005-11-18 21:16 ` Dean Gibson (DB Administrator) <postgresql4@ultimeth.com>
2005-11-19 12:27 ` Nikolay Samokhvalov <samokhvalov@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox