public function toArray($type = Document::SIMPLE)
    {
        switch ($type) {
            case Document::MININAL:
                $this->simple = false;
                $this->complete = false;
                break;

            case Document::SIMPLE:
                $this->simple = true;
                break;

            case Document::COMPLETE:
                $this->complete = true;
                break;

            default:
                throw new DomException('Invalid type', 2);
        }

        return $this->getNodes($this->childNodes, true);
    }