protected function init() {
        if (!file_exists(dirname($this->fullpath))) {
            throw new xml_output_exception('directory_not_exists', dirname($this->fullpath));
        }
        if (file_exists($this->fullpath)) {
            throw new xml_output_exception('file_already_exists', $this->fullpath);
        }
        if (!is_writable(dirname($this->fullpath))) {
            throw new xml_output_exception('directory_not_writable', dirname($this->fullpath));
        }
        // Open the OS file for writing
        if (! $this->fhandle = fopen($this->fullpath, 'w')) {
            throw new xml_output_exception('error_opening_file');
        }
    }