public function fromArray(array $data)
    {
        if (empty($data)) {
            throw new DomException('Array is empty', 2);
        } elseif (count($data) > 1) {
            throw new DomException('Root array accepts only a key', 2);
        } elseif (Helper::seq($data)) {
            throw new DomException('Document accpet only a node', 2);
        }

        if ($this->documentElement) {
            $this->removeChild($this->documentElement);
        }

        $this->enableRestoreInternal(true);

        $this->generate($this, $data);

        $this->raise($this->exceptionlevel);

        $this->enableRestoreInternal(false);
    }