ILIAS  release_7 Revision v7.30-3-g800a261c036
ilMDSaxParser Class Reference
+ Inheritance diagram for ilMDSaxParser:
+ Collaboration diagram for ilMDSaxParser:

Public Member Functions

 __construct ($a_xml_file='')
 Constructor. More...
 
 enableMDParsing ($a_status)
 
 getMDParsingStatus ()
 
 setMDObject (&$md)
 
getMDObject ()
 
 inMetaData ()
 
 setHandlers ($a_xml_parser)
 set event handlers More...
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 handler for end of element More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data More...
 
 __getCharacterData ()
 
 __pushParent (&$md_obj)
 
 __popParent ()
 
 __getParent ()
 
 __construct ($a_xml_file='')
 Constructor. More...
 
 setMDObject (&$md)
 
 inMetaData ()
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 handler for end of element More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data More...
 
 __getCharacterData ()
 
 __pushParent (&$md_obj)
 
__popParent ()
 
__getParent ()
 
- Public Member Functions inherited from ilSaxParser
 __construct ($a_xml_file='', $throwException=false)
 Constructor setup ILIAS global object public. More...
 
 setXMLContent ($a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 create parser More...
 
 setOptions ($a_xml_parser)
 set parser options More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 openXMLFile ()
 open xml file More...
 
 parse ($a_xml_parser, $a_fp=null)
 parse xml file More...
 
 freeParser ($a_xml_parser)
 free xml parser handle More...
 
 setThrowException ($throwException)
 set error handling More...
 
- Public Member Functions inherited from PEAR
 __construct ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Data Fields

 $md_in_md = false
 
 $md_chr_data = ''
 
 $md_cur_el = null
 
 $md_parsing_enabled = null
 
 $md = null
 
 $md_gen
 
- Data Fields inherited from ilSaxParser
 $input_type = null
 
 $xml_content = ''
 
 $ilias
 
 $lng
 
 $xml_file
 
 $throwException = false
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Protected Member Functions

 trimAndStripAttribs (array $attribs)
 
 trimAndStrip (string $input)
 
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

Protected Attributes

 $meta_log
 

Additional Inherited Members

- Static Public Member Functions inherited from PEAR
static & getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
static setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 

Detailed Description

Definition at line 34 of file class.ilMDSaxParser.php.

Constructor & Destructor Documentation

◆ __construct() [1/2]

ilMDSaxParser::__construct (   $a_xml_file = '')

Constructor.

public

Definition at line 65 of file class.ilMDSaxParser.php.

References $DIC, ilSaxParser\$lng, and ILIAS\GlobalScreen\Provider\__construct().

66  {
67  global $DIC;
68 
69  $lng = $DIC['lng'];
70  $tree = $DIC['tree'];
71 
72  $this->meta_log = $DIC->logger()->meta();
73 
74 
75  // Enable parsing. E.g qpl' s will set this value to false
76  $this->md_parsing_enabled = true;
77 
78  parent::__construct($a_xml_file);
79  }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

◆ __construct() [2/2]

ilMDSaxParser::__construct (   $a_xml_file = '')

Constructor.

public

Definition at line 62 of file class.ilMDSaxParser.php.

References ilSaxParser\$lng, and ILIAS\GlobalScreen\Provider\__construct().

63  {
64  global $lng, $tree;
65 
66  parent::__construct($a_xml_file);
67  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ __getCharacterData() [1/2]

ilMDSaxParser::__getCharacterData ( )

Definition at line 606 of file class.ilMDSaxParser.php.

607  {
608  return trim($this->md_chr_data);
609  }

◆ __getCharacterData() [2/2]

ilMDSaxParser::__getCharacterData ( )

Definition at line 666 of file class.ilMDSaxParser.php.

References trimAndStrip().

Referenced by handlerEndTag(), and ilSCORM13MDImporter\handlerEndTag().

667  {
668  return $this->trimAndStrip($this->md_chr_data);
669  }
trimAndStrip(string $input)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getParent() [1/2]

& ilMDSaxParser::__getParent ( )

Definition at line 625 of file class.ilMDSaxParser.php.

626  {
627  return $this->md_parent[count($this->md_parent) - 1];
628  }

◆ __getParent() [2/2]

ilMDSaxParser::__getParent ( )

Definition at line 689 of file class.ilMDSaxParser.php.

Referenced by ilMDXMLCopier\handlerBeginTag(), ilSCORM13MDImporter\handlerBeginTag(), handlerBeginTag(), ilMDXMLCopier\handlerEndTag(), handlerEndTag(), and ilSCORM13MDImporter\handlerEndTag().

690  {
691  return $this->md_parent[count($this->md_parent) - 1];
692  }
+ Here is the caller graph for this function:

◆ __popParent() [1/2]

& ilMDSaxParser::__popParent ( )

Definition at line 619 of file class.ilMDSaxParser.php.

620  {
621  $class = &array_pop($this->md_parent);
622  unset($class);
623  #echo '<br />Popped '.get_class($class);
624  }

◆ __popParent() [2/2]

ilMDSaxParser::__popParent ( )

Definition at line 679 of file class.ilMDSaxParser.php.

Referenced by ilMDXMLCopier\handlerEndTag(), handlerEndTag(), and ilSCORM13MDImporter\handlerEndTag().

680  {
681  $this->meta_log->debug('New parent stack (pop)....');
682  $class = array_pop($this->md_parent);
683  foreach ((array) $this->md_parent as $class) {
684  $this->meta_log->debug(get_class($class));
685  }
686  $this->meta_log->debug(is_object($class) ? get_class($class) : 'null');
687  unset($class);
688  }
+ Here is the caller graph for this function:

◆ __pushParent() [1/2]

ilMDSaxParser::__pushParent ( $md_obj)

Definition at line 611 of file class.ilMDSaxParser.php.

612  {
613  $this->md_parent[] = &$md_obj;
614  #echo '<br />';
615  foreach ($this->md_parent as $class) {
616  #echo get_class($class).' -> ';
617  }
618  }

◆ __pushParent() [2/2]

ilMDSaxParser::__pushParent ( $md_obj)

Definition at line 671 of file class.ilMDSaxParser.php.

Referenced by ilMDXMLCopier\handlerBeginTag(), ilSCORM13MDImporter\handlerBeginTag(), and handlerBeginTag().

672  {
673  $this->md_parent[] = &$md_obj;
674  $this->meta_log->debug('New parent stack (push)...');
675  foreach ($this->md_parent as $class) {
676  $this->meta_log->debug(get_class($class));
677  }
678  }
+ Here is the caller graph for this function:

◆ enableMDParsing()

ilMDSaxParser::enableMDParsing (   $a_status)

Definition at line 81 of file class.ilMDSaxParser.php.

Referenced by ilQuestionPageParser\buildTag(), ilContObjParser\handlerBeginTag(), ilQuestionPageParser\handlerEndTag(), and ilContObjParser\handlerEndTag().

82  {
83  $this->md_parsing_enabled = (bool) $a_status;
84  }
+ Here is the caller graph for this function:

◆ getMDObject()

& ilMDSaxParser::getMDObject ( )

Definition at line 94 of file class.ilMDSaxParser.php.

Referenced by ilSCORM13MDImporter\import(), and ilMDXMLCopier\startParsing().

95  {
96  return is_object($this->md) ? $this->md : false;
97  }
+ Here is the caller graph for this function:

◆ getMDParsingStatus()

ilMDSaxParser::getMDParsingStatus ( )

Definition at line 85 of file class.ilMDSaxParser.php.

References $md_parsing_enabled.

Referenced by ilSCORM13MDImporter\handlerBeginTag(), handlerBeginTag(), handlerCharacterData(), handlerEndTag(), and ilSCORM13MDImporter\handlerEndTag().

86  {
87  return (bool) $this->md_parsing_enabled;
88  }
+ Here is the caller graph for this function:

◆ handlerBeginTag() [1/2]

ilMDSaxParser::handlerBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Definition at line 83 of file class.ilMDSaxParser.php.

References __getParent(), and __pushParent().

84  {
85  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
86 
87  switch ($a_name) {
88  case 'MetaData':
89  $this->md_in_md = true;
90  $this->__pushParent($this->md);
91  break;
92 
93  case 'General':
94  $this->md_gen = &$this->md->addGeneral();
95  $this->md_gen->setStructure($a_attribs['Structure']);
96  $this->md_gen->save();
97  $this->__pushParent($this->md_gen);
98  break;
99 
100  case 'Identifier':
101  $par = &$this->__getParent();
102  $this->md_ide = &$par->addIdentifier();
103  $this->md_ide->setCatalog($a_attribs['Catalog']);
104  $this->md_ide->setEntry($a_attribs['Entry']);
105  $this->md_ide->save();
106  $this->__pushParent($this->md_ide);
107  break;
108 
109  case 'Title':
110  $par = &$this->__getParent();
111  $par->setTitleLanguage(new ilMDLanguageItem($a_attribs['Language']));
112  break;
113 
114  case 'Language':
115  $par = &$this->__getParent();
116  $this->md_lan = &$par->addLanguage();
117  $this->md_lan->setLanguage(new ilMDLanguageItem($a_attribs['Language']));
118  $this->md_lan->save();
119  $this->__pushParent($this->md_lan);
120  break;
121 
122  case 'Description':
123  $par = &$this->__getParent();
124 
125  if (strtolower(get_class($par)) == 'ilmdrights' or
126  strtolower(get_class($par)) == 'ilmdannotation' or
127  strtolower(get_class($par)) == 'ilmdclassification') {
128  $par->setDescriptionLanguage(new ilMDLanguageItem($a_attribs['Language']));
129  break;
130  } else {
131  $this->md_des = &$par->addDescription();
132  $this->md_des->setDescriptionLanguage(new ilMDLanguageItem($a_attribs['Language']));
133  $this->md_des->save();
134  $this->__pushParent($this->md_des);
135  break;
136  }
137 
138  // no break
139  case 'Keyword':
140  $par = &$this->__getParent();
141  $this->md_key = &$par->addKeyword();
142  $this->md_key->setKeywordLanguage(new ilMDLanguageItem($a_attribs['Language']));
143  $this->md_key->save();
144  $this->__pushParent($this->md_key);
145  break;
146 
147  case 'Coverage':
148  $par = &$this->__getParent();
149  $par->setCoverageLanguage(new ilMDLanguageItem($a_attribs['Language']));
150  break;
151 
152  case 'Lifecycle':
153  $par = &$this->__getParent();
154  $this->md_lif = &$par->addLifecycle();
155  $this->md_lif->setStatus($a_attribs['Status']);
156  $this->md_lif->save();
157  $this->__pushParent($this->md_lif);
158  break;
159 
160  case 'Version':
161  $par = &$this->__getParent();
162  $par->setVersionLanguage(new ilMDLanguageItem($a_attribs['Language']));
163  break;
164 
165  case 'Contribute':
166  $par = &$this->__getParent();
167  $this->md_con = &$par->addContribute();
168  $this->md_con->setRole($a_attribs['Role']);
169  $this->md_con->save();
170  $this->__pushParent($this->md_con);
171  break;
172 
173  case 'Entity':
174  $par = &$this->__getParent();
175 
176  if (strtolower(get_class($par)) == 'ilmdcontribute') {
177  $this->md_ent = &$par->addEntity();
178  $this->md_ent->save();
179  $this->__pushParent($this->md_ent);
180  break;
181  } else {
182  // single element in 'Annotation'
183  break;
184  }
185  // no break
186  case 'Date':
187  break;
188 
189  case 'Meta-Metadata':
190  $par = &$this->__getParent();
191  $this->md_met = &$par->addMetaMetadata();
192  $this->md_met->setMetaDataScheme($a_attribs['MetadataScheme']);
193  $this->md_met->setLanguage(new ilMDLanguageItem($a_attribs['Language']));
194  $this->md_met->save();
195  $this->__pushParent($this->md_met);
196  break;
197 
198  case 'Technical':
199  $par = &$this->__getParent();
200  $this->md_tec = &$par->addTechnical();
201  $this->md_tec->save();
202  $this->__pushParent($this->md_tec);
203  break;
204 
205  case 'Format':
206  $par = &$this->__getParent();
207  $this->md_for = &$par->addFormat();
208  $this->md_for->save();
209  $this->__pushParent($this->md_for);
210  break;
211 
212  case 'Size':
213  break;
214 
215  case 'Location':
216  $par = &$this->__getParent();
217  $this->md_loc = &$par->addLocation();
218  $this->md_loc->setLocationType($a_attribs['Type']);
219  $this->md_loc->save();
220  $this->__pushParent($this->md_loc);
221  break;
222 
223  case 'Requirement':
224  $par = &$this->__getParent();
225  $this->md_req = &$par->addRequirement();
226  $this->md_req->save();
227  $this->__pushParent($this->md_req);
228  break;
229 
230  case 'OrComposite':
231  $par = &$this->__getParent();
232  $this->md_orc = &$par->addOrComposite();
233  $this->__pushParent($this->md_orc);
234  break;
235 
236  case 'Type':
237  break;
238 
239  case 'OperatingSystem':
240  $par = &$this->__getParent();
241  $par->setOperatingSystemName($a_attribs['Name']);
242  $par->setOperatingSystemMinimumVersion($a_attribs['MinimumVersion']);
243  $par->setOperatingSystemMaximumVersion($a_attribs['MaximumVersion']);
244  break;
245 
246  case 'Browser':
247  $par = &$this->__getParent();
248  $par->setBrowserName($a_attribs['Name']);
249  $par->setBrowserMinimumVersion($a_attribs['MinimumVersion']);
250  $par->setBrowserMaximumVersion($a_attribs['MaximumVersion']);
251  break;
252 
253  case 'InstallationRemarks':
254  $par = &$this->__getParent();
255  $par->setInstallationRemarksLanguage(new ilMDLanguageItem($a_attribs['Language']));
256  break;
257 
258  case 'OtherPlatformRequirements':
259  $par = &$this->__getParent();
260  $par->setOtherPlatformRequirementsLanguage(new ilMDLanguageItem($a_attribs['Language']));
261  break;
262 
263  case 'Duration':
264  break;
265 
266  case 'Educational':
267  $par = &$this->__getParent();
268  $this->md_edu = &$par->addEducational();
269  $this->md_edu->setInteractivityType($a_attribs['InteractivityType']);
270  $this->md_edu->setLearningResourceType($a_attribs['LearningResourceType']);
271  $this->md_edu->setInteractivityLevel($a_attribs['InteractivityLevel']);
272  $this->md_edu->setSemanticDensity($a_attribs['SemanticDensity']);
273  $this->md_edu->setIntendedEndUserRole($a_attribs['IntendedEndUserRole']);
274  $this->md_edu->setContext($a_attribs['Context']);
275  $this->md_edu->setDifficulty($a_attribs['Difficulty']);
276  $this->md_edu->save();
277  $this->__pushParent($this->md_edu);
278  break;
279 
280  case 'TypicalAgeRange':
281  $par = &$this->__getParent();
282  $this->md_typ = &$par->addTypicalAgeRange();
283  $this->md_typ->setTypicalAgeRangeLanguage(new ilMDLanguageItem($a_attribs['Language']));
284  $this->md_typ->save();
285  $this->__pushParent($this->md_typ);
286  break;
287 
288  case 'TypicalLearningTime':
289  break;
290 
291  case 'Rights':
292  $par = &$this->__getParent();
293  $this->md_rig = &$par->addRights();
294  $this->md_rig->setCosts($a_attribs['Costs']);
295  $this->md_rig->setCopyrightAndOtherRestrictions($a_attribs['CopyrightAndOtherRestrictions']);
296  $this->md_rig->save();
297  $this->__pushParent($this->md_rig);
298  break;
299 
300  case 'Relation':
301  $par = &$this->__getParent();
302  $this->md_rel = &$par->addRelation();
303  $this->md_rel->setKind($a_attribs['Kind']);
304  $this->md_rel->save();
305  $this->__pushParent($this->md_rel);
306  break;
307 
308  case 'Resource':
309  break;
310 
311  case 'Identifier_':
312  $par = &$this->__getParent();
313  $this->md_ide_ = &$par->addIdentifier_();
314  $this->md_ide_->setCatalog($a_attribs['Catalog']);
315  $this->md_ide_->setEntry($a_attribs['Entry']);
316  $this->md_ide_->save();
317  $this->__pushParent($this->md_ide_);
318  break;
319 
320  case 'Annotation':
321  $par = &$this->__getParent();
322  $this->md_ann = &$par->addAnnotation();
323  $this->md_ann->save();
324  $this->__pushParent($this->md_ann);
325  break;
326 
327  case 'Classification':
328  $par = &$this->__getParent();
329  $this->md_cla = &$par->addClassification();
330  $this->md_cla->setPurpose($a_attribs['Purpose']);
331  $this->md_cla->save();
332  $this->__pushParent($this->md_cla);
333  break;
334 
335  case 'TaxonPath':
336  $par = &$this->__getParent();
337  $this->md_taxp = &$par->addTaxonPath();
338  $this->md_taxp->save();
339  $this->__pushParent($this->md_taxp);
340  break;
341 
342  case 'Source':
343  $par = &$this->__getParent();
344  $par->setSourceLanguage(new ilMDLanguageItem($a_attribs['Language']));
345  break;
346 
347  case 'Taxon':
348  $par = &$this->__getParent();
349  $this->md_tax = &$par->addTaxon();
350  $this->md_tax->setTaxonLanguage(new ilMDLanguageItem($a_attribs['Language']));
351  $this->md_tax->setTaxonId($a_attribs['Id']);
352  $this->md_tax->save();
353  $this->__pushParent($this->md_tax);
354  break;
355  }
356  }
+ Here is the call graph for this function:

◆ handlerBeginTag() [2/2]

ilMDSaxParser::handlerBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Definition at line 122 of file class.ilMDSaxParser.php.

References __getParent(), __pushParent(), getMDParsingStatus(), and trimAndStripAttribs().

Referenced by ilQuestionPageParser\buildTag().

123  {
124  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
125 
126  $a_attribs = $this->trimAndStripAttribs($a_attribs);
127 
128  if (!$this->getMDParsingStatus()) {
129  return;
130  }
131 
132  switch ($a_name) {
133  case 'MetaData':
134  $this->md_in_md = true;
135  $this->__pushParent($this->md);
136  break;
137 
138  case 'General':
139  $this->md_gen = &$this->md->addGeneral();
140  $this->md_gen->setStructure($a_attribs['Structure']);
141  $this->md_gen->save();
142  $this->__pushParent($this->md_gen);
143  break;
144 
145  case 'Identifier':
146  $par = &$this->__getParent();
147  $this->md_ide = &$par->addIdentifier();
148  $this->md_ide->setCatalog($a_attribs['Catalog']);
149  $this->md_ide->setEntry($a_attribs['Entry']);
150  $this->md_ide->save();
151  $this->__pushParent($this->md_ide);
152  break;
153 
154  case 'Title':
155  $par = &$this->__getParent();
156  $par->setTitleLanguage(new ilMDLanguageItem($a_attribs['Language']));
157  break;
158 
159  case 'Language':
160  $par = &$this->__getParent();
161  $this->md_lan = &$par->addLanguage();
162  $this->md_lan->setLanguage(new ilMDLanguageItem($a_attribs['Language']));
163  $this->md_lan->save();
164  $this->__pushParent($this->md_lan);
165  break;
166 
167  case 'Description':
168  $par = &$this->__getParent();
169 
170  if (strtolower(get_class($par)) == 'ilmdrights' or
171  strtolower(get_class($par)) == 'ilmdannotation' or
172  strtolower(get_class($par)) == 'ilmdclassification') {
173  $par->setDescriptionLanguage(new ilMDLanguageItem($a_attribs['Language']));
174  break;
175  } else {
176  $this->md_des = &$par->addDescription();
177  $this->md_des->setDescriptionLanguage(new ilMDLanguageItem($a_attribs['Language']));
178  $this->md_des->save();
179  $this->__pushParent($this->md_des);
180  break;
181  }
182 
183  // no break
184  case 'Keyword':
185  $par = &$this->__getParent();
186  if (!in_array(get_class($par), ["ilMD"])) {
187  $this->md_key = &$par->addKeyword();
188  $this->md_key->setKeywordLanguage(new ilMDLanguageItem($a_attribs['Language']));
189  $this->md_key->save();
190  $this->__pushParent($this->md_key);
191  }
192  break;
193 
194  case 'Coverage':
195  $par = &$this->__getParent();
196  $par->setCoverageLanguage(new ilMDLanguageItem($a_attribs['Language']));
197  break;
198 
199  case 'Lifecycle':
200  $par = &$this->__getParent();
201  $this->md_lif = &$par->addLifecycle();
202  $this->md_lif->setStatus($a_attribs['Status']);
203  $this->md_lif->save();
204  $this->__pushParent($this->md_lif);
205  break;
206 
207  case 'Version':
208  $par = &$this->__getParent();
209  $par->setVersionLanguage(new ilMDLanguageItem($a_attribs['Language']));
210  break;
211 
212  case 'Contribute':
213  $par = &$this->__getParent();
214  $this->md_con = &$par->addContribute();
215  $this->md_con->setRole($a_attribs['Role']);
216  $this->md_con->save();
217  $this->__pushParent($this->md_con);
218  break;
219 
220  case 'Entity':
221  $par = &$this->__getParent();
222 
223  if (strtolower(get_class($par)) == 'ilmdcontribute') {
224  $this->md_ent = &$par->addEntity();
225  $this->md_ent->save();
226  $this->__pushParent($this->md_ent);
227  break;
228  } else {
229  // single element in 'Annotation'
230  break;
231  }
232  // no break
233  case 'Date':
234  break;
235 
236  case 'Meta-Metadata':
237  $par = &$this->__getParent();
238  $this->md_met = &$par->addMetaMetadata();
239  $this->md_met->setMetaDataScheme($a_attribs['MetadataScheme']);
240  $this->md_met->setLanguage(new ilMDLanguageItem($a_attribs['Language']));
241  $this->md_met->save();
242  $this->__pushParent($this->md_met);
243  break;
244 
245  case 'Technical':
246  $par = &$this->__getParent();
247  $this->md_tec = &$par->addTechnical();
248  $this->md_tec->save();
249  $this->__pushParent($this->md_tec);
250  break;
251 
252  case 'Format':
253  $par = &$this->__getParent();
254  $this->md_for = &$par->addFormat();
255  $this->md_for->save();
256  $this->__pushParent($this->md_for);
257  break;
258 
259  case 'Size':
260  break;
261 
262  case 'Location':
263  $par = &$this->__getParent();
264  $this->md_loc = &$par->addLocation();
265  $this->md_loc->setLocationType($a_attribs['Type']);
266  $this->md_loc->save();
267  $this->__pushParent($this->md_loc);
268  break;
269 
270  case 'Requirement':
271  $par = &$this->__getParent();
272  $this->md_req = &$par->addRequirement();
273  $this->md_req->save();
274  $this->__pushParent($this->md_req);
275  break;
276 
277  case 'OrComposite':
278  $par = &$this->__getParent();
279  $this->md_orc = &$par->addOrComposite();
280  $this->__pushParent($this->md_orc);
281  break;
282 
283  case 'Type':
284  break;
285 
286  case 'OperatingSystem':
287  $par = &$this->__getParent();
288  $par->setOperatingSystemName($a_attribs['Name']);
289  $par->setOperatingSystemMinimumVersion($a_attribs['MinimumVersion']);
290  $par->setOperatingSystemMaximumVersion($a_attribs['MaximumVersion']);
291  break;
292 
293  case 'Browser':
294  $par = &$this->__getParent();
295  $par->setBrowserName($a_attribs['Name']);
296  $par->setBrowserMinimumVersion($a_attribs['MinimumVersion']);
297  $par->setBrowserMaximumVersion($a_attribs['MaximumVersion']);
298  break;
299 
300  case 'InstallationRemarks':
301  $par = &$this->__getParent();
302  $par->setInstallationRemarksLanguage(new ilMDLanguageItem($a_attribs['Language']));
303  break;
304 
305  case 'OtherPlatformRequirements':
306  $par = &$this->__getParent();
307  $par->setOtherPlatformRequirementsLanguage(new ilMDLanguageItem($a_attribs['Language']));
308  break;
309 
310  case 'Duration':
311  break;
312 
313  case 'Educational':
314  $par = &$this->__getParent();
315  $this->md_edu = &$par->addEducational();
316  $this->md_edu->setInteractivityType($a_attribs['InteractivityType']);
317  $this->md_edu->setLearningResourceType($a_attribs['LearningResourceType']);
318  $this->md_edu->setInteractivityLevel($a_attribs['InteractivityLevel']);
319  $this->md_edu->setSemanticDensity($a_attribs['SemanticDensity']);
320  $this->md_edu->setIntendedEndUserRole($a_attribs['IntendedEndUserRole']);
321  $this->md_edu->setContext($a_attribs['Context']);
322  $this->md_edu->setDifficulty($a_attribs['Difficulty']);
323  $this->md_edu->save();
324  $this->__pushParent($this->md_edu);
325  break;
326 
327  case 'TypicalAgeRange':
328  $par = &$this->__getParent();
329  $this->md_typ = &$par->addTypicalAgeRange();
330  $this->md_typ->setTypicalAgeRangeLanguage(new ilMDLanguageItem($a_attribs['Language']));
331  $this->md_typ->save();
332  $this->__pushParent($this->md_typ);
333  break;
334 
335  case 'TypicalLearningTime':
336  break;
337 
338  case 'Rights':
339  $par = &$this->__getParent();
340  $this->md_rig = &$par->addRights();
341  $this->md_rig->setCosts($a_attribs['Cost']);
342  $this->md_rig->setCopyrightAndOtherRestrictions($a_attribs['CopyrightAndOtherRestrictions']);
343  $this->md_rig->save();
344  $this->__pushParent($this->md_rig);
345  break;
346 
347  case 'Relation':
348  $par = &$this->__getParent();
349  $this->md_rel = &$par->addRelation();
350  $this->md_rel->setKind($a_attribs['Kind']);
351  $this->md_rel->save();
352  $this->__pushParent($this->md_rel);
353  break;
354 
355  case 'Resource':
356  break;
357 
358  case 'Identifier_':
359  $par = &$this->__getParent();
360  $this->md_ide_ = &$par->addIdentifier_();
361  $this->md_ide_->setCatalog($a_attribs['Catalog']);
362  $this->md_ide_->setEntry($a_attribs['Entry']);
363  $this->md_ide_->save();
364  $this->__pushParent($this->md_ide_);
365  break;
366 
367  case 'Annotation':
368  $par = &$this->__getParent();
369  $this->md_ann = &$par->addAnnotation();
370  $this->md_ann->save();
371  $this->__pushParent($this->md_ann);
372  break;
373 
374  case 'Classification':
375  $par = &$this->__getParent();
376  $this->md_cla = &$par->addClassification();
377  $this->md_cla->setPurpose($a_attribs['Purpose']);
378  $this->md_cla->save();
379  $this->__pushParent($this->md_cla);
380  break;
381 
382  case 'TaxonPath':
383  $par = &$this->__getParent();
384  $this->md_taxp = &$par->addTaxonPath();
385  $this->md_taxp->save();
386  $this->__pushParent($this->md_taxp);
387  break;
388 
389  case 'Source':
390  $par = &$this->__getParent();
391  $par->setSourceLanguage(new ilMDLanguageItem($a_attribs['Language']));
392  break;
393 
394  case 'Taxon':
395  $par = &$this->__getParent();
396  $this->md_tax = &$par->addTaxon();
397  $this->md_tax->setTaxonLanguage(new ilMDLanguageItem($a_attribs['Language']));
398  $this->md_tax->setTaxonId($a_attribs['Id']);
399  $this->md_tax->save();
400  $this->__pushParent($this->md_tax);
401  break;
402  }
403  }
trimAndStripAttribs(array $attribs)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handlerCharacterData() [1/2]

ilMDSaxParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Definition at line 593 of file class.ilMDSaxParser.php.

References inMetaData().

594  {
595  if ($this->inMetaData() and $a_data != "\n") {
596  // Replace multiple tabs with one space
597  $a_data = preg_replace("/\t+/", " ", $a_data);
598 
599  $this->md_chr_data .= $a_data;
600  }
601  }
+ Here is the call graph for this function:

◆ handlerCharacterData() [2/2]

ilMDSaxParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Definition at line 649 of file class.ilMDSaxParser.php.

References getMDParsingStatus(), and inMetaData().

650  {
651  if (!$this->getMDParsingStatus()) {
652  return;
653  }
654 
655  if ($this->inMetaData() and $a_data != "\n") {
656  // Replace multiple tabs with one space
657  $a_data = preg_replace("/\t+/", " ", $a_data);
658 
659  $this->md_chr_data .= $a_data;
660  }
661  }
+ Here is the call graph for this function:

◆ handlerEndTag() [1/2]

ilMDSaxParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

Definition at line 361 of file class.ilMDSaxParser.php.

References __getCharacterData(), __getParent(), and __popParent().

362  {
363  switch ($a_name) {
364  case 'MetaData':
365  $this->md_parent = array();
366  $this->md_in_md = false;
367  break;
368 
369  case 'General':
370  $par = &$this->__getParent();
371  $par->update();
372  $this->__popParent();
373  break;
374 
375  case 'Identifier':
376  $par = &$this->__getParent();
377  $par->update();
378  $this->__popParent();
379  break;
380 
381  case 'Title':
382  $par = &$this->__getParent();
383  $par->setTitle($this->__getCharacterData());
384  break;
385 
386  case 'Language':
387  $par = &$this->__getParent();
388  $par->update();
389  $this->__popParent();
390  break;
391 
392  case 'Description':
393  $par = &$this->__getParent();
394  if (strtolower(get_class($par)) == 'ilmddescription') {
395  $par->setDescription($this->__getCharacterData());
396  $par->update();
397  $this->__popParent();
398  break;
399  } else {
400  $par->setDescription($this->__getCharacterData());
401  break;
402  }
403 
404  // no break
405  case 'Keyword':
406  $par = &$this->__getParent();
407  $par->setKeyword($this->__getCharacterData());
408  $par->update();
409  $this->__popParent();
410  break;
411 
412  case 'Coverage':
413  $par = &$this->__getParent();
414  $par->setCoverage($this->__getCharacterData());
415  break;
416 
417  case 'Lifecycle':
418  $par = &$this->__getParent();
419  $par->update();
420  $this->__popParent();
421  break;
422 
423  case 'Version':
424  $par = &$this->__getParent();
425  $par->setVersion($this->__getCharacterData());
426  break;
427 
428  case 'Contribute':
429  $par = &$this->__getParent();
430  $par->update();
431  $this->__popParent();
432  break;
433 
434  case 'Entity':
435  $par = &$this->__getParent();
436 
437  if (strtolower(get_class($par)) == 'ilmdentity') {
438  $par->setEntity($this->__getCharacterData());
439  $par->update();
440  $this->__popParent();
441  } else {
442  // Single element in 'Annotation'
443  $par->setEntity($this->__getCharacterData());
444  }
445  break;
446 
447  case 'Date':
448  $par = &$this->__getParent();
449  $par->setDate($this->__getCharacterData());
450  break;
451 
452  case 'Meta-Metadata':
453  $par = &$this->__getParent();
454  $par->update();
455  $this->__popParent();
456  break;
457 
458  case 'Technical':
459  $par = &$this->__getParent();
460  $par->update();
461  $this->__popParent();
462  break;
463 
464  case 'Format':
465  $par = &$this->__getParent();
466  $par->setFormat($this->__getCharacterData());
467  $par->update();
468  $this->__popParent();
469  break;
470 
471  case 'Size':
472  $par = &$this->__getParent();
473  $par->setSize($this->__getCharacterData());
474  break;
475 
476  case 'Location':
477  $par = &$this->__getParent();
478  $par->setLocation($this->__getCharacterData());
479  $par->update();
480  $this->__popParent();
481  break;
482 
483  case 'Requirement':
484  $par = &$this->__getParent();
485  $par->update();
486  $this->__popParent();
487  break;
488 
489  case 'OrComposite':
490  $this->__popParent();
491  break;
492 
493  case 'Type':
494  break;
495 
496  case 'OperatingSystem':
497  break;
498 
499  case 'Browser':
500  break;
501 
502  case 'InstallationRemarks':
503  $par = &$this->__getParent();
504  $par->setInstallationRemarks($this->__getCharacterData());
505  break;
506 
507  case 'OtherPlatformRequirements':
508  $par = &$this->__getParent();
509  $par->setOtherPlatformRequirements($this->__getCharacterData());
510  break;
511 
512  case 'Duration':
513  $par = &$this->__getParent();
514  $par->setDuration($this->__getCharacterData());
515  break;
516 
517  case 'Educational':
518  $par = &$this->__getParent();
519  $par->update();
520  $this->__popParent();
521  break;
522 
523  case 'TypicalAgeRange':
524  $par = &$this->__getParent();
525  $par->setTypicalAgeRange($this->__getCharacterData());
526  $par->update();
527  $this->__popParent();
528  break;
529 
530  case 'TypicalLearningTime':
531  $par = &$this->__getParent();
532  $par->setTypicalLearningTime($this->__getCharacterData());
533  break;
534 
535  case 'Rights':
536  $par = &$this->__getParent();
537  $par->update();
538  $this->__popParent();
539  break;
540 
541  case 'Relation':
542  $par = &$this->__getParent();
543  $par->update();
544  $this->__popParent();
545  break;
546 
547  case 'Resource':
548  break;
549 
550  case 'Identifier_':
551  $par = &$this->__getParent();
552  $par->update();
553  $this->__popParent();
554  break;
555 
556  case 'Annotation':
557  $par = &$this->__getParent();
558  $par->update();
559  $this->__popParent();
560  break;
561 
562  case 'Classification':
563  $par = &$this->__getParent();
564  $par->update();
565  $this->__popParent();
566  break;
567 
568  case 'TaxonPath':
569  $par = &$this->__getParent();
570  $par->update();
571  $this->__popParent();
572  break;
573 
574  case 'Taxon':
575  $par = &$this->__getParent();
576  $par->setTaxon($this->__getCharacterData());
577  $par->update();
578  $this->__popParent();
579  break;
580 
581  case 'Source':
582  $par = &$this->__getParent();
583  $par->setSource($this->__getCharacterData());
584  break;
585 
586  }
587  $this->md_chr_data = '';
588  }
+ Here is the call graph for this function:

◆ handlerEndTag() [2/2]

ilMDSaxParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

Definition at line 408 of file class.ilMDSaxParser.php.

References __getCharacterData(), __getParent(), __popParent(), and getMDParsingStatus().

409  {
410  if (!$this->getMDParsingStatus()) {
411  return;
412  }
413 
414  switch ($a_name) {
415  case 'MetaData':
416  $this->md_parent = array();
417  $this->md_in_md = false;
418  break;
419 
420  case 'General':
421  $par = &$this->__getParent();
422  $par->update();
423  $this->__popParent();
424  break;
425 
426  case 'Identifier':
427  $par = &$this->__getParent();
428  $par->update();
429  $this->__popParent();
430  break;
431 
432  case 'Title':
433  $par = &$this->__getParent();
434  $par->setTitle($this->__getCharacterData());
435  break;
436 
437  case 'Language':
438  $par = &$this->__getParent();
439  $par->update();
440  $this->__popParent();
441  break;
442 
443  case 'Description':
444  $par = $this->__getParent();
445  if ($par instanceof ilMDRights) {
446  $par->parseDescriptionFromImport(
447  $this->__getCharacterData()
448  );
449  } else {
450  $par->setDescription($this->__getCharacterData());
451  }
452  $par->update();
453  if ($par instanceof ilMDDescription) {
454  $this->__popParent();
455  }
456  break;
457 
458  case 'Keyword':
459  $par = &$this->__getParent();
460  if (!in_array(get_class($par), ["ilMD"])) {
461  $par->setKeyword($this->__getCharacterData());
462  $this->meta_log->debug("Keyword: " . $this->__getCharacterData());
463  $par->update();
464  $this->__popParent();
465  }
466  break;
467 
468  case 'Coverage':
469  $par = &$this->__getParent();
470  $par->setCoverage($this->__getCharacterData());
471  break;
472 
473  case 'Lifecycle':
474  $par = &$this->__getParent();
475  $par->update();
476  $this->__popParent();
477  break;
478 
479  case 'Version':
480  $par = &$this->__getParent();
481  $par->setVersion($this->__getCharacterData());
482  break;
483 
484  case 'Contribute':
485  $par = &$this->__getParent();
486  $par->update();
487  $this->__popParent();
488  break;
489 
490  case 'Entity':
491  $par = &$this->__getParent();
492 
493  if (strtolower(get_class($par)) == 'ilmdentity') {
494  $par->setEntity($this->__getCharacterData());
495  $par->update();
496  $this->__popParent();
497  } else {
498  // Single element in 'Annotation'
499  $par->setEntity($this->__getCharacterData());
500  }
501  break;
502 
503  case 'Date':
504  $par = &$this->__getParent();
505  $par->setDate($this->__getCharacterData());
506  break;
507 
508  case 'Meta-Metadata':
509  $par = &$this->__getParent();
510  $par->update();
511  $this->__popParent();
512  break;
513 
514  case 'Technical':
515  $par = &$this->__getParent();
516  $par->update();
517  $this->__popParent();
518  break;
519 
520  case 'Format':
521  $par = &$this->__getParent();
522  $par->setFormat($this->__getCharacterData());
523  $par->update();
524  $this->__popParent();
525  break;
526 
527  case 'Size':
528  $par = &$this->__getParent();
529  $par->setSize($this->__getCharacterData());
530  break;
531 
532  case 'Location':
533  $par = &$this->__getParent();
534  $par->setLocation($this->__getCharacterData());
535  $par->update();
536  $this->__popParent();
537  break;
538 
539  case 'Requirement':
540  $par = &$this->__getParent();
541  $par->update();
542  $this->__popParent();
543  break;
544 
545  case 'OrComposite':
546  $this->__popParent();
547  break;
548 
549  case 'Type':
550  break;
551 
552  case 'OperatingSystem':
553  break;
554 
555  case 'Browser':
556  break;
557 
558  case 'InstallationRemarks':
559  $par = &$this->__getParent();
560  $par->setInstallationRemarks($this->__getCharacterData());
561  break;
562 
563  case 'OtherPlatformRequirements':
564  $par = &$this->__getParent();
565  $par->setOtherPlatformRequirements($this->__getCharacterData());
566  break;
567 
568  case 'Duration':
569  $par = &$this->__getParent();
570  $par->setDuration($this->__getCharacterData());
571  break;
572 
573  case 'Educational':
574  $par = &$this->__getParent();
575  $par->update();
576  $this->__popParent();
577  break;
578 
579  case 'TypicalAgeRange':
580  $par = &$this->__getParent();
581  $par->setTypicalAgeRange($this->__getCharacterData());
582  $par->update();
583  $this->__popParent();
584  break;
585 
586  case 'TypicalLearningTime':
587  $par = &$this->__getParent();
588  $par->setTypicalLearningTime($this->__getCharacterData());
589  break;
590 
591  case 'Rights':
592  $par = &$this->__getParent();
593  $par->update();
594  $this->__popParent();
595  break;
596 
597  case 'Relation':
598  $par = &$this->__getParent();
599  $par->update();
600  $this->__popParent();
601  break;
602 
603  case 'Resource':
604  break;
605 
606  case 'Identifier_':
607  $par = &$this->__getParent();
608  $par->update();
609  $this->__popParent();
610  break;
611 
612  case 'Annotation':
613  $par = &$this->__getParent();
614  $par->update();
615  $this->__popParent();
616  break;
617 
618  case 'Classification':
619  $par = &$this->__getParent();
620  $par->update();
621  $this->__popParent();
622  break;
623 
624  case 'TaxonPath':
625  $par = &$this->__getParent();
626  $par->update();
627  $this->__popParent();
628  break;
629 
630  case 'Taxon':
631  $par = &$this->__getParent();
632  $par->setTaxon($this->__getCharacterData());
633  $par->update();
634  $this->__popParent();
635  break;
636 
637  case 'Source':
638  $par = &$this->__getParent();
639  $par->setSource($this->__getCharacterData());
640  break;
641 
642  }
643  $this->md_chr_data = '';
644  }
+ Here is the call graph for this function:

◆ inMetaData() [1/2]

ilMDSaxParser::inMetaData ( )

Definition at line 74 of file class.ilMDSaxParser.php.

References $md_in_md.

75  {
76  return $this->md_in_md;
77  }

◆ inMetaData() [2/2]

ilMDSaxParser::inMetaData ( )

Definition at line 99 of file class.ilMDSaxParser.php.

References $md_in_md.

Referenced by handlerCharacterData().

100  {
101  return $this->md_in_md;
102  }
+ Here is the caller graph for this function:

◆ setHandlers()

ilMDSaxParser::setHandlers (   $a_xml_parser)

set event handlers

Parameters
resourcereference to the xml parser private

Definition at line 110 of file class.ilMDSaxParser.php.

111  {
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');
115  }

◆ setMDObject() [1/2]

ilMDSaxParser::setMDObject ( $md)

Definition at line 69 of file class.ilMDSaxParser.php.

References $md.

70  {
71  $this->md = &$md;
72  }

◆ setMDObject() [2/2]

ilMDSaxParser::setMDObject ( $md)

Definition at line 90 of file class.ilMDSaxParser.php.

References $md.

Referenced by ilMDXMLParser\__construct(), ilWebLinkXmlParser\__construct(), ilMDXMLCopier\__construct(), ilCourseXMLParser\__construct(), and ilGroupXMLParser\__construct().

91  {
92  $this->md = &$md;
93  }
+ Here is the caller graph for this function:

◆ trimAndStrip()

ilMDSaxParser::trimAndStrip ( string  $input)
protected

Definition at line 703 of file class.ilMDSaxParser.php.

References ilUtil\stripSlashes().

Referenced by __getCharacterData(), ilWebLinkXmlParser\handlerEndTag(), ilGroupXMLParser\handlerEndTag(), ilCourseXMLParser\handlerEndTag(), and trimAndStripAttribs().

703  : string
704  {
705  return ilUtil::stripSlashes(trim($input));
706  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ trimAndStripAttribs()

ilMDSaxParser::trimAndStripAttribs ( array  $attribs)
protected

Definition at line 694 of file class.ilMDSaxParser.php.

References $ret, and trimAndStrip().

Referenced by ilWebLinkXmlParser\handlerBeginTag(), ilCourseXMLParser\handlerBeginTag(), handlerBeginTag(), and ilGroupXMLParser\handlerBeginTag().

694  : array
695  {
696  $ret = [];
697  foreach ($attribs as $k => $v) {
698  $ret[$k] = $this->trimAndStrip((string) $v);
699  }
700  return $ret;
701  }
trimAndStrip(string $input)
$ret
Definition: parser.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $md

ilMDSaxParser::$md = null

Definition at line 48 of file class.ilMDSaxParser.php.

Referenced by ilWebLinkXmlParser\handlerBeginTag(), and setMDObject().

◆ $md_chr_data

ilMDSaxParser::$md_chr_data = ''

Definition at line 37 of file class.ilMDSaxParser.php.

◆ $md_cur_el

ilMDSaxParser::$md_cur_el = null

Definition at line 39 of file class.ilMDSaxParser.php.

◆ $md_gen

ilMDSaxParser::$md_gen

Definition at line 53 of file class.ilMDSaxParser.php.

◆ $md_in_md

ilMDSaxParser::$md_in_md = false

Definition at line 36 of file class.ilMDSaxParser.php.

Referenced by inMetaData().

◆ $md_parsing_enabled

ilMDSaxParser::$md_parsing_enabled = null

Definition at line 44 of file class.ilMDSaxParser.php.

Referenced by getMDParsingStatus().

◆ $meta_log

ilMDSaxParser::$meta_log
protected

Definition at line 58 of file class.ilMDSaxParser.php.


The documentation for this class was generated from the following file: