xml and postgresql

Started by aravind chandualmost 18 years ago3 messagesgeneral
Jump to latest
#1aravind chandu
avin_friends@yahoo.com

Hi folks,

            
I need to load xml data in to database can you tell me they way how do
I import xml data into postgresql database.

lets dat this is the xml file

<bookstore>
<book category="CHILDREN">
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title>Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>

so finally the table name should be bookstore and column names are category,title,
author,year,price and all the information in the xml file should be ported to the table
can you please tell me how to do this its a bit confusing to me as i am just a beginner to
this.

Thanks in advance,
Aravind.

#2Gwyneth Morrison
gwynethm@toadware.ca
In reply to: aravind chandu (#1)
Re: xml and postgresql

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
aravind chandu wrote:
<blockquote cite="mid:152688.69120.qm@web31408.mail.mud.yahoo.com"
type="cite">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;"
valign="top">Hi folks,<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
I need to load xml data in to database can you tell me they way how do
I import xml data into postgresql database.<br>
<br>
lets dat this is the xml file<br>
<br>
<pre>&lt;bookstore&gt;
&lt;book category="CHILDREN"&gt;
&lt;title&gt;Harry Potter&lt;/title&gt;
&lt;author&gt;J K. Rowling&lt;/author&gt;
&lt;year&gt;2005&lt;/year&gt;
&lt;price&gt;29.99&lt;/price&gt;
&lt;/book&gt;
&lt;book category="WEB"&gt;
&lt;title&gt;Learning XML&lt;/title&gt;
&lt;author&gt;Erik T. Ray&lt;/author&gt;
&lt;year&gt;2003&lt;/year&gt;
&lt;price&gt;39.95&lt;/price&gt;
&lt;/book&gt;
&lt;/bookstore&gt;

so finally the table name should be bookstore and column names are category,title,
author,year,price and all the information in the xml file should be ported to the table
can you please tell me how to do this its a bit confusing to me as i am just a beginner to
this.

Thanks in advance,
Aravind.
</pre>
<br>
<br>
</td>
</tr>
</tbody>
</table>
<br>
</blockquote>
I have written a python program that may help you.<br>
<br>
It is part of a larger project I hope to post in a few days. <br>
<br>
Or I could sent it to you.<br>
<br>
Gwyneth<br>
</body>
</html>

#3William Leite Araújo
william.bh@gmail.com
In reply to: Gwyneth Morrison (#2)
Re: xml and postgresql

On Fri, Jul 4, 2008 at 11:01 AM, Gwyneth Morrison <gwynethm@toadware.ca>
wrote:

aravind chandu wrote:

Hi folks,

I need to load xml data in to database can you tell me they
way how do I import xml data into postgresql database.

lets dat this is the xml file

<bookstore>
<book category="CHILDREN">

Why "category" is not a Element of book, as all others? Is it a

column of table "bookstore"?

<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title>Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>

so finally the table name should be bookstore and column names are category,title,
author,year,price and all the information in the xml file should be ported to the table
can you please tell me how to do this its a bit confusing to me as i am just a beginner to
this.

Thanks in advance,
Aravind.

I have written a python program that may help you.

It is part of a larger project I hope to post in a few days.

Or I could sent it to you.

Gwyneth

--
William Leite Araújo
Pai 0.6 beta 2.1 "Dizem que agora melhora..."