ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 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...
 
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct() [1/2]

ilMDSaxParser::__construct (   $a_xml_file = '')

Constructor.

public

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

References ilSaxParser\$lng, and ilLoggerFactory\getLogger().

71  {
72  global $lng, $tree;
73 
74  $this->meta_log = ilLoggerFactory::getLogger("meta");
75 
76 
77  // Enable parsing. E.g qpl' s will set this value to false
78  $this->md_parsing_enabled = true;
79 
80  parent::__construct($a_xml_file);
81  }
static getLogger($a_component_id)
Get component logger.
+ 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.

63  {
64  global $lng, $tree;
65 
66  parent::__construct($a_xml_file);
67  }

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 660 of file class.ilMDSaxParser.php.

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

661  {
662  return trim($this->md_chr_data);
663  }
+ 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 679 of file class.ilMDSaxParser.php.

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

680  {
681  return $this->md_parent[count($this->md_parent) - 1];
682  }
+ 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 673 of file class.ilMDSaxParser.php.

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

674  {
675  $class = array_pop($this->md_parent);
676  $this->meta_log->debug(is_object($class) ? get_class($class) : 'null');
677  unset($class);
678  }
+ 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 665 of file class.ilMDSaxParser.php.

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

666  {
667  $this->md_parent[] =&$md_obj;
668  #echo '<br />';
669  foreach ($this->md_parent as $class) {
670  #echo get_class($class).' -> ';
671  }
672  }
+ Here is the caller graph for this function:

◆ enableMDParsing()

ilMDSaxParser::enableMDParsing (   $a_status)

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

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

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

◆ getMDObject()

& ilMDSaxParser::getMDObject ( )

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

Referenced by ilSCORM13MDImporter\import().

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

◆ getMDParsingStatus()

ilMDSaxParser::getMDParsingStatus ( )

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

References $md_parsing_enabled.

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

88  {
89  return (bool) $this->md_parsing_enabled;
90  }
+ 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 124 of file class.ilMDSaxParser.php.

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

125  {
126  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
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  $this->md_key =&$par->addKeyword();
187  $this->md_key->setKeywordLanguage(new ilMDLanguageItem($a_attribs['Language']));
188  $this->md_key->save();
189  $this->__pushParent($this->md_key);
190  break;
191 
192  case 'Coverage':
193  $par =&$this->__getParent();
194  $par->setCoverageLanguage(new ilMDLanguageItem($a_attribs['Language']));
195  break;
196 
197  case 'Lifecycle':
198  $par =&$this->__getParent();
199  $this->md_lif =&$par->addLifecycle();
200  $this->md_lif->setStatus($a_attribs['Status']);
201  $this->md_lif->save();
202  $this->__pushParent($this->md_lif);
203  break;
204 
205  case 'Version':
206  $par =&$this->__getParent();
207  $par->setVersionLanguage(new ilMDLanguageItem($a_attribs['Language']));
208  break;
209 
210  case 'Contribute':
211  $par =&$this->__getParent();
212  $this->md_con =&$par->addContribute();
213  $this->md_con->setRole($a_attribs['Role']);
214  $this->md_con->save();
215  $this->__pushParent($this->md_con);
216  break;
217 
218  case 'Entity':
219  $par =&$this->__getParent();
220 
221  if (strtolower(get_class($par)) == 'ilmdcontribute') {
222  $this->md_ent =&$par->addEntity();
223  $this->md_ent->save();
224  $this->__pushParent($this->md_ent);
225  break;
226  } else {
227  // single element in 'Annotation'
228  break;
229  }
230  // no break
231  case 'Date':
232  break;
233 
234  case 'Meta-Metadata':
235  $par =&$this->__getParent();
236  $this->md_met =&$par->addMetaMetadata();
237  $this->md_met->setMetaDataScheme($a_attribs['MetadataScheme']);
238  $this->md_met->setLanguage(new ilMDLanguageItem($a_attribs['Language']));
239  $this->md_met->save();
240  $this->__pushParent($this->md_met);
241  break;
242 
243  case 'Technical':
244  $par =&$this->__getParent();
245  $this->md_tec =&$par->addTechnical();
246  $this->md_tec->save();
247  $this->__pushParent($this->md_tec);
248  break;
249 
250  case 'Format':
251  $par =&$this->__getParent();
252  $this->md_for =&$par->addFormat();
253  $this->md_for->save();
254  $this->__pushParent($this->md_for);
255  break;
256 
257  case 'Size':
258  break;
259 
260  case 'Location':
261  $par =&$this->__getParent();
262  $this->md_loc =&$par->addLocation();
263  $this->md_loc->setLocationType($a_attribs['Type']);
264  $this->md_loc->save();
265  $this->__pushParent($this->md_loc);
266  break;
267 
268  case 'Requirement':
269  $par =&$this->__getParent();
270  $this->md_req =&$par->addRequirement();
271  $this->md_req->save();
272  $this->__pushParent($this->md_req);
273  break;
274 
275  case 'OrComposite':
276  $par =&$this->__getParent();
277  $this->md_orc =&$par->addOrComposite();
278  $this->__pushParent($this->md_orc);
279  break;
280 
281  case 'Type':
282  break;
283 
284  case 'OperatingSystem':
285  $par =&$this->__getParent();
286  $par->setOperatingSystemName($a_attribs['Name']);
287  $par->setOperatingSystemMinimumVersion($a_attribs['MinimumVersion']);
288  $par->setOperatingSystemMaximumVersion($a_attribs['MaximumVersion']);
289  break;
290 
291  case 'Browser':
292  $par =&$this->__getParent();
293  $par->setBrowserName($a_attribs['Name']);
294  $par->setBrowserMinimumVersion($a_attribs['MinimumVersion']);
295  $par->setBrowserMaximumVersion($a_attribs['MaximumVersion']);
296  break;
297 
298  case 'InstallationRemarks':
299  $par =&$this->__getParent();
300  $par->setInstallationRemarksLanguage(new ilMDLanguageItem($a_attribs['Language']));
301  break;
302 
303  case 'OtherPlatformRequirements':
304  $par =&$this->__getParent();
305  $par->setOtherPlatformRequirementsLanguage(new ilMDLanguageItem($a_attribs['Language']));
306  break;
307 
308  case 'Duration':
309  break;
310 
311  case 'Educational':
312  $par =&$this->__getParent();
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();
322  $this->__pushParent($this->md_edu);
323  break;
324 
325  case 'TypicalAgeRange':
326  $par =&$this->__getParent();
327  $this->md_typ =&$par->addTypicalAgeRange();
328  $this->md_typ->setTypicalAgeRangeLanguage(new ilMDLanguageItem($a_attribs['Language']));
329  $this->md_typ->save();
330  $this->__pushParent($this->md_typ);
331  break;
332 
333  case 'TypicalLearningTime':
334  break;
335 
336  case 'Rights':
337  $par =&$this->__getParent();
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();
342  $this->__pushParent($this->md_rig);
343  break;
344 
345  case 'Relation':
346  $par =&$this->__getParent();
347  $this->md_rel =&$par->addRelation();
348  $this->md_rel->setKind($a_attribs['Kind']);
349  $this->md_rel->save();
350  $this->__pushParent($this->md_rel);
351  break;
352 
353  case 'Resource':
354  break;
355 
356  case 'Identifier_':
357  $par =&$this->__getParent();
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();
362  $this->__pushParent($this->md_ide_);
363  break;
364 
365  case 'Annotation':
366  $par =&$this->__getParent();
367  $this->md_ann =&$par->addAnnotation();
368  $this->md_ann->save();
369  $this->__pushParent($this->md_ann);
370  break;
371 
372  case 'Classification':
373  $par =&$this->__getParent();
374  $this->md_cla =&$par->addClassification();
375  $this->md_cla->setPurpose($a_attribs['Purpose']);
376  $this->md_cla->save();
377  $this->__pushParent($this->md_cla);
378  break;
379 
380  case 'TaxonPath':
381  $par =&$this->__getParent();
382  $this->md_taxp =&$par->addTaxonPath();
383  $this->md_taxp->save();
384  $this->__pushParent($this->md_taxp);
385  break;
386 
387  case 'Source':
388  $par =&$this->__getParent();
389  $par->setSourceLanguage(new ilMDLanguageItem($a_attribs['Language']));
390  break;
391 
392  case 'Taxon':
393  $par =&$this->__getParent();
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();
398  $this->__pushParent($this->md_tax);
399  break;
400  }
401  }
+ Here is the call 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 643 of file class.ilMDSaxParser.php.

References getMDParsingStatus(), and inMetaData().

644  {
645  if (!$this->getMDParsingStatus()) {
646  return;
647  }
648 
649  if ($this->inMetaData() and $a_data != "\n") {
650  // Replace multiple tabs with one space
651  $a_data = preg_replace("/\t+/", " ", $a_data);
652 
653  $this->md_chr_data .= $a_data;
654  }
655  }
+ 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(), __popParent(), and array.

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  }
Create styles array
The data for the language used.
+ 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 406 of file class.ilMDSaxParser.php.

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

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

References $md_in_md.

Referenced by handlerCharacterData().

102  {
103  return $this->md_in_md;
104  }
+ 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 112 of file class.ilMDSaxParser.php.

113  {
114  xml_set_object($a_xml_parser, $this);
115  xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
116  xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
117  }

◆ 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 92 of file class.ilMDSaxParser.php.

References $md.

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

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

Field Documentation

◆ $md

ilMDSaxParser::$md = null

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

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

◆ $md_chr_data

ilMDSaxParser::$md_chr_data = ''

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

◆ $md_cur_el

ilMDSaxParser::$md_cur_el = null

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

◆ $md_gen

ilMDSaxParser::$md_gen

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

◆ $md_in_md

ilMDSaxParser::$md_in_md = false

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

Referenced by inMetaData().

◆ $md_parsing_enabled

ilMDSaxParser::$md_parsing_enabled = null

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

Referenced by getMDParsingStatus().

◆ $meta_log

ilMDSaxParser::$meta_log
protected

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


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