Re: Convertig xml into array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Edward Kay wrote:
>> -----Original Message-----
>> From: Dave Goodchild [mailto:buddhamagnet@xxxxxxxxx]
>> Sent: 27 November 2007 08:36
>> To: PHP General list
>> Subject:  Convertig xml into array
>>
>>
>> Hi guys. I have the following XML file which I want to convert into a
>> multidimensional array. I am using PHP5 so don't want to use
>> SimpleXML as apparently there are issues with sessions and after
>> conversion I want to pass this array into the session. Any ideas on
>> the best and cleanest way to do this?
>>
>> <snip>
> 
> Hi Dave,
> 
> The issue with sessions is simply that SimpleXML objects do not persist in
> sessions. To workaround this, just use the asXML() function so your XML is
> stored as a string in the session. You can then recreate the SimpleXML
> object from this string as and when you need it.

You can create a class derived from the SimpleXML objects that implement
__sleep and __wakeup that do this for you transparently.... just make
sure the classes are loaded prior to the session starting (or use autoload)

Col

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux