ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 618 of file class.ilMDSaxParser.php.

619  {
620  return trim($this->md_chr_data);
621  }

◆ __getCharacterData() [2/2]

ilMDSaxParser::__getCharacterData ( )

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

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

676  {
677  return trim($this->md_chr_data);
678  }
+ Here is the caller graph for this function:

◆ __getParent() [1/2]

& ilMDSaxParser::__getParent ( )

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

639  {
640  return $this->md_parent[count($this->md_parent) - 1];
641  }

◆ __getParent() [2/2]

& ilMDSaxParser::__getParent ( )

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

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

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

◆ __popParent() [1/2]

& ilMDSaxParser::__popParent ( )

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

633  {
634  $class =& array_pop($this->md_parent);
635  unset($class);
636  #echo '<br />Popped '.get_class($class);
637  }

◆ __popParent() [2/2]

& ilMDSaxParser::__popParent ( )

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

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

690  {
691  $class = array_pop($this->md_parent);
692  unset($class);
693  #echo '<br />DELETE '.get_class($class);
694  }
+ Here is the caller graph for this function:

◆ __pushParent() [1/2]

ilMDSaxParser::__pushParent ( $md_obj)

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

624  {
625  $this->md_parent[] =& $md_obj;
626  #echo '<br />';
627  foreach($this->md_parent as $class)
628  {
629  #echo get_class($class).' -> ';
630  }
631  }

◆ __pushParent() [2/2]

ilMDSaxParser::__pushParent ( $md_obj)

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

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

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

References inMetaData().

605  {
606  if ($this->inMetaData() and $a_data != "\n")
607  {
608  // Replace multiple tabs with one space
609  $a_data = preg_replace("/\t+/"," ",$a_data);
610 
611  $this->md_chr_data .= $a_data;
612  }
613  }
+ 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 656 of file class.ilMDSaxParser.php.

References getMDParsingStatus(), and inMetaData().

657  {
658  if(!$this->getMDParsingStatus())
659  {
660  return;
661  }
662 
663  if ($this->inMetaData() and $a_data != "\n")
664  {
665  // Replace multiple tabs with one space
666  $a_data = preg_replace("/\t+/"," ",$a_data);
667 
668  $this->md_chr_data .= $a_data;
669  }
670  }
+ 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 366 of file class.ilMDSaxParser.php.

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

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

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

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