ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSimpleXMLTableDataParser.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
10  protected $file = null;
11  protected $xml = null;
12 
13  protected $value = '';
14 
15  public function __construct($a_xml)
16  {
17  $this->file = $a_xml;
18 
19  $this->xml = simplexml_load_file($this->file);
20  }
21 
22  public function startParsing()
23  {
24  global $ilDB;
25 
26  $table = $this->xml->xpath('/Table');
27  foreach($table[0]->attributes() as $k => $v)
28  {
29  $this->table = $v;
30  }
31 
32  foreach($this->xml->Row as $row)
33  {
34  $data = array();
35  foreach($row->children() as $value)
36  {
37  $type = (string) $value['type'];
38  $content = (string) $value;
39  $data[(string) $value['name']] = array(
40  $type,$content);
41 
42  }
43  $ilDB->insert($this->table,$data);
44  }
45 
46  }
47 
48 }
49 ?>