ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  public function __construct($content, $a_obj_id, $a_rbac_id, $a_type)
13  {
14  $this->setMDObject(new ilMD($a_obj_id, $a_rbac_id, $a_type));
15 
16  // Wenn content eine XML-Datei ist:
17  #parent::__construct($content);
18 
19  // Ist content ein xml-String:
20  parent::__construct();
21  $this->setXMLContent($content);
22  }
23  public function setHandlers($a_xml_parser)
24  {
25  xml_set_object($a_xml_parser, $this);
26  xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
27  xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
28  }
29 
30  public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
31  {
32  if ($this->in_meta_data) {
33  parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
34  return true;
35  }
36 
37 
38  switch ($a_name) {
39  case 'MetaData':
40  $this->in_meta_data = true;
41  parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
42  return true;
43 
44  default:
45  // hier die Tags aller nicht-MetaData Attribute
46  }
47  }
48  public function handlerEndTag($a_xml_parser, $a_name)
49  {
50  if ($this->in_meta_data) {
51  parent::handlerEndTag($a_xml_parser, $a_name);
52  return true;
53  }
54  switch ($a_name) {
55  case 'MetaData':
56  $this->in_meta_data = false;
57  parent::handlerEndTag($a_xml_parser, $a_name);
58  return true;
59 
60  default:
61  // hier die Tags aller nicht-MetaData Attribute
62  }
63  }
64 
65  public function handlerCharacterData($a_xml_parser, $a_data)
66  {
67  if ($this->in_meta_data) {
68  parent::handlerCharacterData($a_xml_parser, $a_data);
69  return true;
70  }
71  }
72 }
$a_type
Definition: workflow.php:92
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)