ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilMDXMLParser.php
Go to the documentation of this file.
1 <?php
2 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDSaxParser.php';
3 
5 {
6  // So k�nnte bspw eine ContentObjectParser Klasse aussehen.
7  // Alle LM spezifischen Attribute werden wie gehabt hier behandelt. Werden Metadata spezifische Attribute �bergeben, werden einfach die
8  // entsprechenden Funktionen von ilMDSaxParser.php aufgerufen.
9  // Wichtig ist nur, da� ein MD-Objekt mit den Object-Ids und dem Objekttyp angelegt wird ($this->setMDObject(new ilMD(...)))
10 
11 
12  function __construct($content,$a_obj_id,$a_rbac_id,$a_type)
13  {
14 
15  $this->setMDObject(new ilMD($a_obj_id,$a_rbac_id,$a_type));
16 
17  // Wenn content eine XML-Datei ist:
18  #parent::__construct($content);
19 
20  // Ist content ein xml-String:
21  parent::__construct();
22  $this->setXMLContent($content);
23 
24  }
25  function setHandlers($a_xml_parser)
26  {
27  xml_set_object($a_xml_parser,$this);
28  xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
29  xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
30  }
31 
32  function handlerBeginTag($a_xml_parser,$a_name,$a_attribs)
33  {
34  if($this->in_meta_data)
35  {
36  parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
37  return true;
38  }
39 
40 
41  switch($a_name)
42  {
43  case 'MetaData':
44  $this->in_meta_data = true;
45  parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
46  return true;
47 
48  default:
49  // hier die Tags aller nicht-MetaData Attribute
50  }
51  }
52  function handlerEndTag($a_xml_parser,$a_name)
53  {
54  if($this->in_meta_data)
55  {
56  parent::handlerEndTag($a_xml_parser,$a_name);
57  return true;
58  }
59  switch($a_name)
60  {
61  case 'MetaData':
62  $this->in_meta_data = false;
63  parent::handlerEndTag($a_xml_parser,$a_name);
64  return true;
65 
66  default:
67  // hier die Tags aller nicht-MetaData Attribute
68  }
69  }
70 
71  function handlerCharacterData($a_xml_parser,$a_data)
72  {
73  if($this->in_meta_data)
74  {
75  parent::handlerCharacterData($a_xml_parser,$a_data);
76  return true;
77  }
78  }
79 
80 
81 
82 }
83 ?>
$a_type
Definition: workflow.php:93
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handlerEndTag($a_xml_parser, $a_name)
__construct($content, $a_obj_id, $a_rbac_id, $a_type)
handlerCharacterData($a_xml_parser, $a_data)
setXMLContent($a_xml_content)
setHandlers($a_xml_parser)