public function fromXml(\SimpleXMLElement $contentXml)
    {
        Validate::notNull($contentXml, 'contentXml');

        $attributes = $contentXml->attributes();

        if (!empty($attributes['type'])) {
            $this->type = (string) $attributes['type'];
        }

        $text = '';
        /** @var \SimpleXMLElement $child */
        foreach ($contentXml->children() as $child) {
            $text .= $child->asXML();
        }

        $this->text = $text;

        $this->xml = $contentXml;
    }