protected function loadOne($file) { $xml = new SimpleXMLElement($file, 0, true); if ((string) $xml->head->title == null) { return null; } $article = new Article(); foreach ($xml->head->meta as $meta) { $name = (string) $meta['name']; $content = (string) $meta['content']; switch ($name) { case 'date': $article->setPublicationDate(new DateTime($content)); break; case 'author': $article->setAuthor($content); break; } } $article->setTitle((string) $xml->head->title); $article->setHash($this->getHash($article->getTitle())); $content = ""; foreach ($xml->body->children() as $child) { $content .= $child->asXml(); } $article->setContent($content); return $article; }