How do i get the contents of a XML file into MySQL?



How do i get the contents of a XML file into MySQL?

I've got a XML file in the following shape:

<?xml version="1.0" ?>
- <PRODUCTS>
- <PRODUCT>
<PRODUCT>1234</PRODUCT>
<DATE>22-10-2005 14:00:00</DATE>
<PROCODE>109</PROCODE>
<PROTYPE>abc</PROTYPE>
<DESCA>text-foo foo-text</DESCA>
<DESCB>foo-bar foo-bar</DESCB>
</PRODUCT>
- <PRODUCT>
<PRODUCT>5678</PRODUCT>
<DATE>23-10-2005 15:00:00</DATE>
<PROCODE>020</PROCODE>
<PROTYPE>def</PROTYPE>
<DESCA>foo-bar foo-bar</DESCA>
<DESCB>foo-foo bar-bar</DESCB>
</PRODUCT>
</PRODUCTS>

How do I put each part in a MySQL DB so it looks like:

[ROW1] => 1234 || 22-10-2005 14:00:00 || 109 || abc || text-foo
foo-text || foo-bar foo-bar
[ROW2] => 5678 || 23-10-2005 15:00:00 || 020 || def || foo-text
text-bar || foo-foo bar-bar

I found an XML2Array script but that dumps the XML into a 'multi
level' (is that nested?) array. I don't know how to pull that
apart into readable chunks for MySQL.
It would be nice if there is a function or something in PHP that
does XML2MySQL.

Any help is greatly appreciated.

Thanks in advance!

.



Relevant Pages

  • Re: How do I choose a database program?
    ... It depends on your 'user' requirements, and your programming savvy. ... Anything from an XML file to MySql would work, Access is a good program, but ... This is for our basketball league with over 1000 kids ...
    (microsoft.public.access.gettingstarted)
  • Re: ADO/MYSQL
    ... Basically i need to access a mysql database server ... load the data. ... load the information using the structure of the XML file. ... them with ADO... ...
    (borland.public.delphi.database.ado)
  • parse xml file, put results in mysql db
    ... I'm a ruby newbie, parsing an xml file and putting results in mysql ... I can parse the data and print it out ok. ... Problem comes when I try to insert it into the mysql db - I get an error ...
    (comp.lang.ruby)
  • Re: xml c# sql server 2005 what a mess
    ... I know pretty much nothing about MySql but I expect there is an ODBC ... MySql database from SqlServer and run then simply run queries to get ... aforementioned Xml file. ... now i have to read this file and store its content in a sql server 2005 ...
    (microsoft.public.dotnet.csharp.general)