public function restoreValueFromXmlString($xmlString)
{
$zones = array();
$attributes = array();
$layout = null;
if ($xmlString) {
$dom = new DOMDocument('1.0', 'utf-8');
$dom->loadXML($xmlString);
$root = $dom->documentElement;
foreach ($root->childNodes as $node) {
if ($node->nodeType !== XML_ELEMENT_NODE) {
continue;
}
switch ($node->nodeName) {
case 'zone':
$zone = $this->restoreZoneFromXml($node);
$zones[] = $zone;
break;
case 'zone_layout':
$layout = $node->nodeValue;
break;
default:
$attributes[$node->nodeName] = $node->nodeValue;
break;
}
}
if ($root->hasAttributes()) {
foreach ($root->attributes as $attr) {
$attributes[$attr->name] = $attr->value;
}
}
}
return new Parts\Page(array('zones' => $zones, 'layout' => $layout, 'attributes' => $attributes));
}