ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilDomDocument.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12{
13 private $doc;
14 private $errors = array();
15
20 public function __construct()
21 {
22 $this->doc = new DOMDocument();
23 }
24
28 public function __call($a_method, $a_args)
29 {
30 if (in_array($a_method, array("validate", "loadXML"))) {
31 set_error_handler(array($this, "handleError"));
32 $rv = call_user_func_array(array($this->doc, $a_method), $a_args);
33 restore_error_handler();
34 return $rv;
35 } else {
36 return call_user_func_array(array($this->doc, $a_method), $a_args);
37 }
38 }
39
43 public function __get($a_mem)
44 {
45 if ($a_mem == "errors") {
46 return $this->errors;
47 } else {
48 return $this->doc->$a_mem;
49 }
50 }
51
55 public function __set($a_mem, $a_val)
56 {
57 $this->_delegate->$a_mem = $a_val;
58 }
59
63 public function handleError($a_no, $a_string, $a_file = null, $a_line = null, $a_context = null)
64 {
65 $pos = strpos($a_string, "]:");
66 $err = trim(substr($a_string, $pos + 2));
67 $this->errors[] = $err;
68 }
69}
An exception for terminatinating execution or to throw for unit testing.
Dom document wrapper.
handleError($a_no, $a_string, $a_file=null, $a_line=null, $a_context=null)
Handle error.
__call($a_method, $a_args)
Call.
__set($a_mem, $a_val)
Set.
__construct()
Constructor.