private function validate(SimpleXMLElement $phpDocumentor): void
    {
        libxml_clear_errors();
        $priorSetting = libxml_use_internal_errors(true);

        $dom = new \DOMDocument();
        $domElement = dom_import_simplexml($phpDocumentor);
        $domElement = $dom->importNode($domElement, true);
        $dom->appendChild($domElement);

        $dom->schemaValidate($this->schemaPath);

        $error = libxml_get_last_error();

        if ($error !== false) {
            throw new InvalidArgumentException(trim($error->message));
        }

        libxml_use_internal_errors($priorSetting);
    }