public function start_element($parser, $name, $attrs)
{
$current = end($this->categorystack);
if ($name == 'CATEGORY') {
echo "Creating new category " . $attrs['NAME'] . " under {$current}\n";
$category = new \stdClass();
$category->name = $attrs['NAME'];
$category->parent = $current;
$newcat = $this->create_category($category);
if (isset($attrs['OLDID'])) {
$this->coursesmap[$attrs['OLDID']] = $newcat->id;
}
$this->categorystack[] = $newcat->id;
}
}