24 include_once
'./Services/Xml/classes/class.ilSaxParser.php';
72 $this->meta_log = $DIC->logger()->meta();
76 $this->md_parsing_enabled =
true;
78 parent::__construct($a_xml_file);
83 $this->md_parsing_enabled = (bool) $a_status;
96 return is_object($this->md) ? $this->md :
false;
112 xml_set_object($a_xml_parser, $this);
113 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
114 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
124 include_once
'Services/MetaData/classes/class.ilMDLanguageItem.php';
132 $this->md_in_md =
true;
137 $this->md_gen = &$this->md->addGeneral();
138 $this->md_gen->setStructure($a_attribs[
'Structure']);
139 $this->md_gen->save();
145 $this->md_ide = &$par->addIdentifier();
146 $this->md_ide->setCatalog($a_attribs[
'Catalog']);
147 $this->md_ide->setEntry($a_attribs[
'Entry']);
148 $this->md_ide->save();
159 $this->md_lan = &$par->addLanguage();
161 $this->md_lan->save();
168 if (strtolower(get_class($par)) ==
'ilmdrights' or 169 strtolower(get_class($par)) ==
'ilmdannotation' or 170 strtolower(get_class($par)) ==
'ilmdclassification') {
174 $this->md_des = &$par->addDescription();
175 $this->md_des->setDescriptionLanguage(
new ilMDLanguageItem($a_attribs[
'Language']));
176 $this->md_des->save();
184 if (!in_array(get_class($par), [
"ilMD"])) {
185 $this->md_key = &$par->addKeyword();
186 $this->md_key->setKeywordLanguage(
new ilMDLanguageItem($a_attribs[
'Language']));
187 $this->md_key->save();
199 $this->md_lif = &$par->addLifecycle();
200 $this->md_lif->setStatus($a_attribs[
'Status']);
201 $this->md_lif->save();
212 $this->md_con = &$par->addContribute();
213 $this->md_con->setRole($a_attribs[
'Role']);
214 $this->md_con->save();
221 if (strtolower(get_class($par)) ==
'ilmdcontribute') {
222 $this->md_ent = &$par->addEntity();
223 $this->md_ent->save();
234 case 'Meta-Metadata':
236 $this->md_met = &$par->addMetaMetadata();
237 $this->md_met->setMetaDataScheme($a_attribs[
'MetadataScheme']);
239 $this->md_met->save();
245 $this->md_tec = &$par->addTechnical();
246 $this->md_tec->save();
252 $this->md_for = &$par->addFormat();
253 $this->md_for->save();
262 $this->md_loc = &$par->addLocation();
263 $this->md_loc->setLocationType($a_attribs[
'Type']);
264 $this->md_loc->save();
270 $this->md_req = &$par->addRequirement();
271 $this->md_req->save();
277 $this->md_orc = &$par->addOrComposite();
284 case 'OperatingSystem':
286 $par->setOperatingSystemName($a_attribs[
'Name']);
287 $par->setOperatingSystemMinimumVersion($a_attribs[
'MinimumVersion']);
288 $par->setOperatingSystemMaximumVersion($a_attribs[
'MaximumVersion']);
293 $par->setBrowserName($a_attribs[
'Name']);
294 $par->setBrowserMinimumVersion($a_attribs[
'MinimumVersion']);
295 $par->setBrowserMaximumVersion($a_attribs[
'MaximumVersion']);
298 case 'InstallationRemarks':
300 $par->setInstallationRemarksLanguage(
new ilMDLanguageItem($a_attribs[
'Language']));
303 case 'OtherPlatformRequirements':
305 $par->setOtherPlatformRequirementsLanguage(
new ilMDLanguageItem($a_attribs[
'Language']));
313 $this->md_edu = &$par->addEducational();
314 $this->md_edu->setInteractivityType($a_attribs[
'InteractivityType']);
315 $this->md_edu->setLearningResourceType($a_attribs[
'LearningResourceType']);
316 $this->md_edu->setInteractivityLevel($a_attribs[
'InteractivityLevel']);
317 $this->md_edu->setSemanticDensity($a_attribs[
'SemanticDensity']);
318 $this->md_edu->setIntendedEndUserRole($a_attribs[
'IntendedEndUserRole']);
319 $this->md_edu->setContext($a_attribs[
'Context']);
320 $this->md_edu->setDifficulty($a_attribs[
'Difficulty']);
321 $this->md_edu->save();
325 case 'TypicalAgeRange':
327 $this->md_typ = &$par->addTypicalAgeRange();
328 $this->md_typ->setTypicalAgeRangeLanguage(
new ilMDLanguageItem($a_attribs[
'Language']));
329 $this->md_typ->save();
333 case 'TypicalLearningTime':
338 $this->md_rig = &$par->addRights();
339 $this->md_rig->setCosts($a_attribs[
'Cost']);
340 $this->md_rig->setCopyrightAndOtherRestrictions($a_attribs[
'CopyrightAndOtherRestrictions']);
341 $this->md_rig->save();
347 $this->md_rel = &$par->addRelation();
348 $this->md_rel->setKind($a_attribs[
'Kind']);
349 $this->md_rel->save();
358 $this->md_ide_ = &$par->addIdentifier_();
359 $this->md_ide_->setCatalog($a_attribs[
'Catalog']);
360 $this->md_ide_->setEntry($a_attribs[
'Entry']);
361 $this->md_ide_->save();
367 $this->md_ann = &$par->addAnnotation();
368 $this->md_ann->save();
372 case 'Classification':
374 $this->md_cla = &$par->addClassification();
375 $this->md_cla->setPurpose($a_attribs[
'Purpose']);
376 $this->md_cla->save();
382 $this->md_taxp = &$par->addTaxonPath();
383 $this->md_taxp->save();
394 $this->md_tax = &$par->addTaxon();
395 $this->md_tax->setTaxonLanguage(
new ilMDLanguageItem($a_attribs[
'Language']));
396 $this->md_tax->setTaxonId($a_attribs[
'Id']);
397 $this->md_tax->save();
414 $this->md_parent = array();
415 $this->md_in_md =
false;
444 $par->parseDescriptionFromImport(
458 if (!in_array(get_class($par), [
"ilMD"])) {
491 if (strtolower(get_class($par)) ==
'ilmdentity') {
506 case 'Meta-Metadata':
550 case 'OperatingSystem':
556 case 'InstallationRemarks':
561 case 'OtherPlatformRequirements':
577 case 'TypicalAgeRange':
584 case 'TypicalLearningTime':
616 case 'Classification':
641 $this->md_chr_data =
'';
655 $a_data = preg_replace(
"/\t+/",
" ", $a_data);
657 $this->md_chr_data .= $a_data;
666 return trim($this->md_chr_data);
671 $this->md_parent[] = &$md_obj;
672 $this->meta_log->debug(
'New parent stack (push)...');
673 foreach ($this->md_parent as $class) {
674 $this->meta_log->debug(get_class($class));
679 $this->meta_log->debug(
'New parent stack (pop)....');
680 $class = array_pop($this->md_parent);
681 foreach ((array) $this->md_parent as $class) {
682 $this->meta_log->debug(get_class($class));
684 $this->meta_log->debug(is_object($class) ? get_class($class) :
'null');
689 return $this->md_parent[count($this->md_parent) - 1];
__construct($a_xml_file='')
Constructor.
enableMDParsing($a_status)
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
setHandlers($a_xml_parser)
set event handlers
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element