public function path_start_reached($path) {

        if ($path === '/MOODLE_BACKUP/COURSE/MODULES/MOD') {
            $this->currentmod = null;
            $forbidden = true;

        } else if (strpos($path, '/MOODLE_BACKUP/COURSE/MODULES/MOD') === 0) {
            // expand the MOD paths so that they contain the module name
            $path = str_replace('/MOODLE_BACKUP/COURSE/MODULES/MOD', '/MOODLE_BACKUP/COURSE/MODULES/MOD/' . $this->currentmod, $path);
        }

        if ($path === '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK') {
            $this->currentblock = null;
            $forbidden = true;

        } else if (strpos($path, '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK') === 0) {
            // expand the BLOCK paths so that they contain the module name
            $path = str_replace('/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK', '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK/' . $this->currentblock, $path);
        }

        if (empty($this->pathelements[$path])) {
            return;
        }

        $element = $this->pathelements[$path];
        $pobject = $element->get_processing_object();
        $method  = $element->get_start_method();

        if (method_exists($pobject, $method)) {
            if (empty($forbidden)) {
                $pobject->$method();

            } else {
                // this path is not supported because we do not know the module/block yet
                throw new coding_exception('Attaching the on-start event listener to the root MOD or BLOCK element is forbidden.');
            }
        }
    }