/** * Init message from string * * @param string $string String * @throws InvalidArgumentException * @return Oggetto_Messenger_Model_Message_Interface */ public function init($string) { $xml = new Varien_Simplexml_Element($string); if (!$xml->count()) { throw new InvalidArgumentException(Mage::helper('messenger')->__('Message without body cannot be initialized')); } $children = $xml->children(); $body = $children[0]; $this->_meta['_class'] = $body->getName(); foreach ($body->attributes() as $_code => $_value) { $this->_meta[$_code] = (string) $_value; } $this->_data = $this->_xmlToArray($body); return $this; }