ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 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 {
32 set_error_handler(array($this, "handleError"));
33 $rv = call_user_func_array(array($this->doc, $a_method), $a_args);
34 restore_error_handler();
35 return $rv;
36 }
37 else
38 {
39 return call_user_func_array(array($this->doc, $a_method), $a_args);
40 }
41 }
42
46 public function __get($a_mem)
47 {
48 if ($a_mem == "errors")
49 {
50 return $this->errors;
51 }
52 else
53 {
54 return $this->doc->$a_mem;
55 }
56 }
57
61 public function __set($a_mem, $a_val)
62 {
63 $this->_delegate->$a_mem = $a_val;
64 }
65
69 public function handleError($a_no, $a_string, $a_file = null, $a_line = null, $a_context = null)
70 {
71 $pos = strpos($a_string, "]:");
72 $err = trim(substr($a_string, $pos + 2));
73 $this->errors[] = $err;
74 }
75}
76
77?>
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.