Edward Kay wrote:
>> -----Original Message-----
>> From: Dave Goodchild [mailto:[EMAIL PROTECTED]
>> Sent: 27 November 2007 08:36
>> To: PHP General list
>> Subject: [PHP] 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

Reply via email to