ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 */
3require_once('./Services/Xml/classes/class.ilSaxParser.php');
4
10{
11
15 protected $file = null;
19 protected $xml = null;
23 protected $value = '';
24
25
31 public function __construct($a_xml)
32 {
33 $this->file = $a_xml;
34 $this->xml = simplexml_load_file($this->file);
35 }
36
37
38 public function startParsing()
39 {
40 global $ilDB;
41
42 $table = $this->xml->xpath('/Table');
43 foreach ($table[0]->attributes() as $k => $v) {
44 $this->table = $v;
45 }
46
47 foreach ($this->xml->Row as $row) {
48 $data = array();
49 foreach ($row->children() as $value) {
50 $type = (string) $value['type'];
51 $content = (string) $value;
52 $data[(string) $value['name']] = array(
53 $type,
54 $content,
55 );
56 }
57 $ilDB->insert($this->table, $data);
58 }
59 }
60}
An exception for terminatinating execution or to throw for unit testing.
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
__construct($a_xml)
ilSimpleXMLTableDataParser constructor.
$type
if(empty($password)) $table
Definition: pwgen.php:24
global $ilDB