HELP: from XML to mySQL

F

Federico Bari

PLEASE HELP!

Hi all,

i need a simple way to import tables saved in a xml document to a mySQL
databse. I found modules that easily do the opposite process (from mySQL to
XML), but I don't know how to popolate my mySQL database using datas stored
in an xml document. Please could somebody give me any suggestion? Thank you,
from italy

Federico.
 
T

Tad McClellan

Federico Bari said:
PLEASE HELP!


There is no need to shout at us.

I don't know how to popolate my mySQL database using datas stored
in an xml document.


Use an XML parsing module to read the input.

Do stuff to the data.

Use the DBI to write the output.
 
I

Iain Chalmers

Federico Bari said:
PLEASE HELP!

Hi all,

i need a simple way to import tables saved in a xml document to a mySQL
databse. I found modules that easily do the opposite process (from mySQL to
XML), but I don't know how to popolate my mySQL database using datas stored
in an xml document. Please could somebody give me any suggestion? Thank you,
from italy

I don't know how to do what you ask, but of the off chance that its not
atually what you _want_, I'll suggest you might want to look at
Sleepycats native XML database...

http://www.sleepycat.com/

Are you _sure_ you need to somehow try to jam XML data into SQL tables?

big
 
F

Federico Bari

.... hi! Yes I need to have the database in mySQL server. It's a constraint
not a choice. Maybe the right question is: so why XML? I have to send around
italy a client program that will be used to make a medical census for people
having a spinal cord injoury. Each person will need weeks to fill the census
questions because these are a lot and quite difficoult. So this people must
have the possibility to fill the census off line and give us the datas just
at the end. So how store datas in clients program? Not with a Access
database (a lot of money for redistribuition licency) ... but .NET use XML
for this porpouses: stores data and send datas. It also give the possibility
with adapter and adapetr.update classes to update automatically a remote
database. But i need to do this using a secure channel. So ... mySQL
database server give this possbility ... make a secure connection using SSL.
But? BUT the Odbc of mySQL doesn't have SSL connection!!! incredible!??? Yes
.... they make SSL connection for server and not for client (odbc)!!!!! So i
ave just this choice: store data in client PC using, XML, send at the end
datas by XML, save XML datas in mySQL database. Thank you! Fede
 
F

Federico Bari

thank you very much. My hope was that there was a module to update mySQL
database using datas stored in xml file automatically, whitout re-write the
code every time different for heach database and table. nothing of similar?

Federico.
 
J

James Willmore

[Please don't top post - it's rude]
[re-ordered to proper format]
thank you very much. My hope was that there was a module to update mySQL
database using datas stored in xml file automatically, whitout re-write the
code every time different for heach database and table. nothing of similar?

Try searching at http://search.cpan.org/.

You could use one of the XML paring module to write a CSV file and then
either use the database client shell to perform the update or use one of
the DBD modules (like DBD::CSV) and let Perl do the updating.

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
Garbage In -- Gospel Out.
 
C

Chris

Federico said:
[top posting fixed]

There is no need to shout at us.





Use an XML parsing module to read the input.

Do stuff to the data.

Use the DBI to write the output.



thank you very much. My hope was that there was a module to update mySQL
database using datas stored in xml file automatically, whitout re-write the
code every time different for heach database and table. nothing of similar?

Federico.

The question would be how would such a module work? XML is essentially
a free format. It a way of representing data in a variety of ways. It
is essentially a "data structure." To write an XML import function
would require a standardization of the structure or layout of the data
(rows, columns, attributes, data, etc.) Or a "protocol" so to speak.

There are two possibilities that I see could perhaps help you in the
short term:

(1) Standardize your XML data structure, use a Perl XML module to read
your data and parse the XML (like XML::Simple), and run the parsed data
through a "handler" that conforms to your standardized data structure.
So you have a parser and a handler. If your structure needs to change,
you just update your handler and you can still import.

(2) Look into using something like XML-RPC or SOAP. (Which is a fine
example in and off itself of "structuring" XML into a standard protocol
-- that's what I'm talking about.) You could write a wrapper that uses
your SSL gateway and calls an XML-RPC service once inside the door to
update your database. XML-RPC is absolutely brainless to implement and
it quite powerful (and quite unsecure, but if you had an SSL front door,
it could be made secure.)

See if these will help you. Your problem is an interesting one. It's
hard not to feel from your description that it perhaps couldn't use some
help in re-architecting, but I'll refrain from sounding too disparaging;
I'm sure it was done as best as it could be conceived.

Chris
 
C

Chris

Federico said:
[top posting fixed]

There is no need to shout at us.





Use an XML parsing module to read the input.

Do stuff to the data.

Use the DBI to write the output.



thank you very much. My hope was that there was a module to update mySQL
database using datas stored in xml file automatically, whitout re-write the
code every time different for heach database and table. nothing of similar?

Federico.

The question would be how would such a module work? XML is essentially
a free format. It a way of representing data in a variety of ways. It
is essentially a "data structure." To write an XML import function
would require a standardization of the structure or layout of the data
(rows, columns, attributes, data, etc.) Or a "protocol" so to speak.

There are two possibilities that I see could perhaps help you in the
short term:

(1) Standardize your XML data structure, use a Perl XML module to read
your data and parse the XML (like XML::Simple), and run the parsed data
through a "handler" that conforms to your standardized data structure.
So you have a parser and a handler. If your structure needs to change,
you just update your handler and you can still import.

(2) Look into using something like XML-RPC or SOAP. (Which is a fine
example in and off itself of "structuring" XML into a standard protocol
-- that's what I'm talking about.) You could write a wrapper that uses
your SSL gateway and calls an XML-RPC service once inside the door to
update your database. XML-RPC is absolutely brainless to implement and
it quite powerful (and quite unsecure, but if you had an SSL front door,
it could be made secure.)

See if these will help you. Your problem is an interesting one. It's
hard not to feel from your description that it perhaps couldn't use some
help in re-architecting, but I'll refrain from sounding too disparaging;
I'm sure it was done as best as it could be conceived.

Chris
 
A

Andy Baxter

At earth time Thu, 22 Jan 2004 20:52:56 +0100, the following transmission
was received from the entity known as Federico Bari:
PLEASE HELP!

Hi all,

i need a simple way to import tables saved in a xml document to a mySQL
databse. I found modules that easily do the opposite process (from mySQL to
XML), but I don't know how to popolate my mySQL database using datas stored
in an xml document. Please could somebody give me any suggestion? Thank you,
from italy

Federico.

I remember seeing a module that would do something like this, and then
went looking for it again a while back and never found it - it fell into
the bermuda triangle of cpan search.

Had another look, and one of these might help:

DBD:AnyData, DBIx::DBStag

also remember that you can use the keyword 'and' in cpan searches to cut
down the number of hits. (It doesn't say this anywhere I've seen.)
 
F

Federico Bari

i have already given a look there without find anything of useful. I also
give a fast look to the two module you write about in your message but they
seem to convert database into xml and not xml to database!!!

"Andy Baxter" <[email protected]> ha scritto nel
messaggio
At earth time Thu, 22 Jan 2004 20:52:56 +0100, the following transmission
was received from the entity known as Federico Bari:
PLEASE HELP!

Hi all,

i need a simple way to import tables saved in a xml document to a mySQL
databse. I found modules that easily do the opposite process (from mySQL to
XML), but I don't know how to popolate my mySQL database using datas stored
in an xml document. Please could somebody give me any suggestion? Thank you,
from italy

Federico.

I remember seeing a module that would do something like this, and then
went looking for it again a while back and never found it - it fell into
the bermuda triangle of cpan search.

Had another look, and one of these might help:

DBD:AnyData, DBIx::DBStag

also remember that you can use the keyword 'and' in cpan searches to cut
down the number of hits. (It doesn't say this anywhere I've seen.)


--
http://www.niftybits.ukfsn.org/

remove 'n-u-l-l' to email me. html mail or attachments will go in the spam
bin unless notified with
HTML:
 or [attachment] in the subject line.
[/QUOTE]
 
M

Michel Rodriguez

Federico said:
i need a simple way to import tables saved in a xml document to a mySQL
databse. I found modules that easily do the opposite process (from mySQL to
XML), but I don't know how to popolate my mySQL database using datas stored
in an xml document. Please could somebody give me any suggestion? Thank you,
from italy

Did you look at DBD::AnyData?
 
K

Kieren

Federico Bari said:
PLEASE HELP!

Hi all,

i need a simple way to import tables saved in a xml document to a mySQL
databse. I found modules that easily do the opposite process (from mySQL to
XML), but I don't know how to popolate my mySQL database using datas stored
in an xml document. Please could somebody give me any suggestion? Thank you,
from italy

Not perl, but I wouldn't it be best to write some XSL to convert the
XML to SQL?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,826
Members
47,371
Latest member
Brkaa

Latest Threads

Top