Re: Import data from XML file

Поиск
Список
Период
Сортировка
От Will Rutherdale (rutherw)
Тема Re: Import data from XML file
Дата
Msg-id 50A8E1F8D9122546A7F67134915EDB7ABB34A2@xmb-rtp-21a.amer.cisco.com
обсуждение исходный текст
Ответ на Import data from XML file  (Erwin Brandstetter <brsaweda@gmail.com>)
Список pgsql-general
One solution is to use Perl DBI.  DBD::AnyData will read xml.  DBD::Pg
will write to Postgres.

-Will


> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org] On Behalf Of
> Erwin Brandstetter
> Sent: 26 August 2009 12:10
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] Import data from XML file
>
> Hi!
>
> How do you import data from an xml-file?
> For instance, if I have a file like this:
>
> <?xml version="1.0" encoding="utf-8"?>
>  <p_update>
>    <main_categories>
>      <main_category>
>        <main_category_name>Sonstiges</main_category_name>
>        <main_category_id>5</main_category_id>
>      </main_category>
>      <main_category>
>        <main_category_name>Buehne</main_category_name>
>       <main_category_id>2</main_category_id>
>     </main_category>
>     <main_category>
>       <main_category_name>Konzerte</main_category_name>
>       <main_category_id>1</main_category_id>
>     </main_category>
>   </main_categories>
>   <categories>
>     <category>
>       <category_name>Reggae</category_name>
>       <main_category_id>1</main_category_id>
>       <category_id>45</category_id>
>     </category>
>     <category>
>       <category_name>sonstige</category_name>
>       <main_category_id>5</main_category_id>
>       <category_id>44</category_id>
>     </category>
> </categories>
> </p_update>
>
>
> ... and I want a CSV file like this:
>
> main_category_name    main_category_id
> Sonstiges    5
> Buehne    2
>
> category_name    main_category_id   category_id
> Reggae    1    45
> sonstige    5    44
>
>
> Or is there a way to import directly into tables in a postgres
> database?
>
>
> Your help would be appreciated!
> Regards
> Erwin
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

В списке pgsql-general по дате отправления:

Предыдущее
От: Sam Mason
Дата:
Сообщение: Re: No download of Windows binaries without registering?
Следующее
От: Sam Mason
Дата:
Сообщение: Re: Creating index for convert text to integer