/**
  * Import XML
  *
  * @param
  * @return
  */
 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
 {
     include_once './Modules/Category/classes/class.ilObjCategory.php';
     if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
         $refs = ilObject::_getAllReferences($new_id);
         $this->category = ilObjectFactory::getInstanceByRefId(end($refs), false);
     } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) {
         $this->category = ilObjectFactory::getInstanceByRefId($new_id, false);
     } elseif (!$this->category instanceof ilObjCategory) {
         $this->category = new ilObjCategory();
         $this->category->create(true);
     }
     include_once './Modules/Category/classes/class.ilCategoryXmlParser.php';
     try {
         $parser = new ilCategoryXmlParser($a_xml, 0);
         $parser->setCategory($this->category);
         $parser->setMode(ilCategoryXmlParser::MODE_UPDATE);
         $parser->startParsing();
         $a_mapping->addMapping('Modules/Category', 'cat', $a_id, $this->category->getId());
     } catch (ilSaxParserException $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     } catch (Excpetion $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     }
 }
 /**
  * Import XML
  *
  * @param
  * @return
  */
 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
 {
     include_once './Modules/Category/classes/class.ilObjCategory.php';
     if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
         $refs = ilObject::_getAllReferences($new_id);
         $this->category = ilObjectFactory::getInstanceByRefId(end($refs), false);
     } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) {
         $this->category = ilObjectFactory::getInstanceByRefId($new_id, false);
     } elseif (!$this->category instanceof ilObjCategory) {
         $this->category = new ilObjCategory();
         $this->category->create(true);
     }
     include_once './Modules/Category/classes/class.ilCategoryXmlParser.php';
     try {
         $parser = new ilCategoryXmlParser($a_xml, 0);
         $parser->setCategory($this->category);
         $parser->setMode(ilCategoryXmlParser::MODE_UPDATE);
         $parser->startParsing();
         $a_mapping->addMapping('Modules/Category', 'cat', $a_id, $this->category->getId());
     } catch (ilSaxParserException $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     } catch (Excpetion $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     }
     foreach ($a_mapping->getMappingsOfEntity('Services/Container', 'objs') as $old => $new) {
         $type = ilObject::_lookupType($new);
         // see ilGlossaryImporter::importXmlRepresentation()
         // see ilTaxonomyDataSet::importRecord()
         $a_mapping->addMapping("Services/Taxonomy", "tax_item", $type . ":obj:" . $old, $new);
         // this is since 4.3 does not export these ids but 4.4 tax node assignment needs it
         $a_mapping->addMapping("Services/Taxonomy", "tax_item_obj_id", $type . ":obj:" . $old, $new);
     }
 }