Check out the various XML code snippets on the Zend site at
http://www.zend.com/codex.php?CID=15. There may be something there that
satisfies your needs.
--
Tony Marston
http://www.tonymarston.net
"Bob Bedford" <bedford1@notforspammershotmail.com> wrote in message
news:42dcaa9a$0$1162$5402220f@news.sunrise.ch...[color=blue]
>
> "Peter van Schie" <vanschie.peter@gmail.com> a écrit dans le message de
> news: 42dc08cd$0$76226$dbd45001@news.wanadoo.nl...[color=green]
>> Bob Bedford wrote:
>>[color=darkred]
>>> Thanks for reply Peter,
>>>
>>> This is the problem, I've this structure (simplified)
>>>
>>> <data1>
>>> <group1>
>>> <field1>
>>> </field1>
>>> <field2>
>>> </field2>
>>> </group1>
>>> <group2>
>>> <field1>
>>> </field1>
>>> </group2>
>>> </data1>
>>>
>>> and of course, group number is undefined and field number in each group
>>> is also undefined.
>>> What's the best approach ? for now I use xml_parser_create and check
>>> manually everything.
>>>
>>> but if I find a better way to handle datas, probably It will be simpler
>>> to parse and save datas in the database,[/color]
>>
>> Hi Bob,
>>
>> Well, that's what I meant by nested data. That is a lot trickier.
>> There are database engines that support native xml data on which you can
>> use XQuery queries. An example is eXist (
http://exist.sourceforge.net/).
>> But I think you mentioned you want to use MySQL to store the data right?
>> I did read something about MySQL 5 going to support XPath too, but that's
>> not 100% sure yet last time I checked.
>> So for now it's a tough problem to solve with MySQL I'm afraid.
>>
>> --
>>
http://www.phpforums.nl[/color]
> Thanks for help Peter,
>
> Probably there is no way to put datas from a XML file directly in a Mysql
> database, but does it exist a manner to put datas in an array
> automatically, or better in a structure ?
>
> The dream is to have a function that reads a XML file and put it in an
> array then use msqlqueries like
> insert into mytable
> values($struct["group1"]["field1"],$struct["group2"]["field2"]....
> does it exists in PHP ?[color=green]
>>[/color]
>
>[/color]