I want to save a piece of XML code in the customer session. So far I tried with the following code.
// Get customer session.
$customerSession = Mage::getSingleton('customer/session');
// $xml contains a piece of XML code.
$xml= new SimpleXMLElement($xml);
$customerSession->setSegmentList($xml);
But I'm getting the following error.
String could not be parsed as XML
Can anyone suggest how to resolve this? How can I save XML piece of code in customer session?