ILIAS  release_8 Revision v8.24
php4DOMDocument Class Reference
+ Collaboration diagram for php4DOMDocument:

Public Member Functions

 __construct ($source, $file=true, $a_mode=0)
 
 xpath_init ()
 
 free ()
 
 xpath_new_context ()
 
 dump_node ($node)
 
 validate (&$error, bool $throw=false)
 
 create_attribute ($name, $value)
 
 create_cdata_section ($content)
 
 create_comment ($data)
 
 create_element (string $name)
 
 create_text_node ($content)
 
 document_element ()
 
 dump_file ($filename, $compressionmode=false, $format=false)
 
 dump_mem ($format=false, $encoding=false)
 
 get_elements_by_tagname ($name)
 
 html_dump_mem ()
 

Data Fields

 $success = null
 
string $error = ""
 
DOMDocument $myDOMDocument
 

Detailed Description

Definition at line 104 of file inc.xml5compliance.php.

Constructor & Destructor Documentation

◆ __construct()

php4DOMDocument::__construct (   $source,
  $file = true,
  $a_mode = 0 
)

Definition at line 111 of file inc.xml5compliance.php.

112 {
113 $this->myDOMDocument = new DOMDocument();
114 // temporary set error handler
115 set_error_handler('staticxmlerror');
116 $old = ini_set('html_errors', false);
117
118 if (is_object($source)) {
119 $this->myDOMDocument = $source;
120 $this->success = true;
121 } else {
122 if ($file) {
123 $this->success = @$this->myDOMDocument->load($source, $a_mode);
124 } else {
125 $this->success = $this->myDOMDocument->loadXML($source, $a_mode);
126 }
127 }
128
129 // Restore error handling
130 ini_set('html_errors', $old);
131 restore_error_handler();
132
133 if (!$this->success) {
134 $this->error_arr = staticxmlerror(0, "", "", 0, null, true);
135 foreach ($this->error_arr as $error) {
136 $error = str_replace("DOMDocument::loadXML():", "", $error);
137 $this->error .= $error . "<br />";
138 }
139 }
140 }
error(string $a_errmsg)
staticxmlerror(int $errno, string $errstr, ?string $errfile=null, ?int $errline=null, ?array $errcontext=null, bool $ret=false)
$source
Definition: metadata.php:93

References $error, $source, error(), staticxmlerror(), and ILIAS\UI\examples\MessageBox\Success\success().

+ Here is the call graph for this function:

Member Function Documentation

◆ create_attribute()

php4DOMDocument::create_attribute (   $name,
  $value 
)

Definition at line 190 of file inc.xml5compliance.php.

191 {
192 $myAttr = $this->myDOMDocument->createAttribute($name);
193 $myAttr->value = $value;
194
195 return new php4DOMAttr($myAttr);
196 }
if($format !==null) $name
Definition: metadata.php:247

References $name.

◆ create_cdata_section()

php4DOMDocument::create_cdata_section (   $content)

Definition at line 198 of file inc.xml5compliance.php.

199 {
200 return new php4DOMCDATASection($this->myDOMDocument->createCDATASection($content));
201 }

◆ create_comment()

php4DOMDocument::create_comment (   $data)

Definition at line 203 of file inc.xml5compliance.php.

204 {
205 return new php4DOMElement($this->myDOMDocument->createComment($data));
206 }

References $data.

◆ create_element()

php4DOMDocument::create_element ( string  $name)

Definition at line 208 of file inc.xml5compliance.php.

209 {
210 return new php4DOMElement($this->myDOMDocument->createElement($name));
211 }

References $name.

◆ create_text_node()

php4DOMDocument::create_text_node (   $content)

Definition at line 213 of file inc.xml5compliance.php.

214 {
215 return new php4DOMNode($this->myDOMDocument->createTextNode($content));
216 }

◆ document_element()

php4DOMDocument::document_element ( )

Definition at line 218 of file inc.xml5compliance.php.

219 {
220 return new php4DOMElement($this->myDOMDocument->documentElement);
221 }

◆ dump_file()

php4DOMDocument::dump_file (   $filename,
  $compressionmode = false,
  $format = false 
)

Definition at line 223 of file inc.xml5compliance.php.

224 {
225 return $this->myDOMDocument->save($filename);
226 }
$filename
Definition: buildRTE.php:78

References $filename.

◆ dump_mem()

php4DOMDocument::dump_mem (   $format = false,
  $encoding = false 
)

Definition at line 228 of file inc.xml5compliance.php.

229 {
230 $r = $this->myDOMDocument->saveXML();
231 return $r;
232 }

◆ dump_node()

php4DOMDocument::dump_node (   $node)

Definition at line 159 of file inc.xml5compliance.php.

160 {
161 $str = $this->myDOMDocument->saveXML($node->myDOMNode);
162 return $str;
163 }

◆ free()

php4DOMDocument::free ( )

Definition at line 147 of file inc.xml5compliance.php.

148 {
149 unset($this->myDOMDocument);
150 }

◆ get_elements_by_tagname()

php4DOMDocument::get_elements_by_tagname (   $name)

Definition at line 234 of file inc.xml5compliance.php.

235 {
236 $myDOMNodeList = $this->myDOMDocument->getElementsByTagName($name);
237 $nodeSet = array();
238 $i = 0;
239 while ($node = $myDOMNodeList->item($i)) {
240 $nodeSet[] = new php4DOMElement($node);
241 $i++;
242 }
243
244 return $nodeSet;
245 }
$i
Definition: metadata.php:41

References $i, and $name.

◆ html_dump_mem()

php4DOMDocument::html_dump_mem ( )

Definition at line 247 of file inc.xml5compliance.php.

248 {
249 return $this->myDOMDocument->saveHTML();
250 }

◆ validate()

php4DOMDocument::validate ( $error,
bool  $throw = false 
)

Definition at line 166 of file inc.xml5compliance.php.

167 {
168 $ok = false;
169 try {
170 $ok = $this->myDOMDocument->validate();
171 } catch (Exception $e) {
172 if ($throw) {
173 throw $e;
174 }
175 }
176 if (!$ok) {
177 $error = array(array("0", "Unknown Error"));
178
179 if (function_exists("libxml_get_last_error")) {
180 $err = libxml_get_last_error();
181
182 if (is_object($err)) {
183 $error = array(array($err->code, $err->message));
184 }
185 }
186 }
187 return $error;
188 }

References Vendor\Package\$e, and $error.

◆ xpath_init()

php4DOMDocument::xpath_init ( )

Definition at line 143 of file inc.xml5compliance.php.

144 {
145 }

◆ xpath_new_context()

php4DOMDocument::xpath_new_context ( )

Definition at line 153 of file inc.xml5compliance.php.

154 {
155 return xpath_new_context($this);
156 }

References xpath_new_context().

Referenced by xpath_new_context().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $error

string php4DOMDocument::$error = ""

Definition at line 107 of file inc.xml5compliance.php.

Referenced by __construct(), and validate().

◆ $myDOMDocument

DOMDocument php4DOMDocument::$myDOMDocument

Definition at line 108 of file inc.xml5compliance.php.

◆ $success

php4DOMDocument::$success = null

Definition at line 106 of file inc.xml5compliance.php.


The documentation for this class was generated from the following file: