ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
domxml-php4-to-php5.php File Reference

Go to the source code of this file.

Data Structures

class  php4DOMAttr
 
class  php4DOMDocument
 
class  php4DOMElement
 php4DomElement More...
 
class  php4DOMNode
 php4DOMNode More...
 
class  php4DomProcessingInstruction
 
class  php4DOMText
 
class  php4DOMNodelist
 
class  php4DOMXPath
 

Functions

 domxml_new_doc ($version)
 
 domxml_new_xmldoc ($version)
 
 domxml_open_file ($filename, $mode=DOMXML_LOAD_PARSING, &$error=null)
 
 domxml_open_mem ($str, $mode=DOMXML_LOAD_PARSING, &$error=null)
 
 html_doc ($html_doc, $from_file=false)
 
 html_doc_file ($filename)
 
 xmldoc ($str)
 
 xmldocfile ($filename)
 
 xpath_eval ($xpath_context, $eval_str, $contextnode=null)
 
 xpath_new_context ($dom_document)
 
 xpath_register_ns ($xpath_context, $prefix, $namespaceURI)
 
 _entityDecode ($text)
 
 _error_report ($error)
 

Variables

const DOMXML_LOAD_PARSING 0
 
const DOMXML_LOAD_VALIDATING 1
 
const DOMXML_LOAD_RECOVERING 2
 
const DOMXML_LOAD_SUBSTITUTE_ENTITIES 4
 
const DOMXML_LOAD_DONT_KEEP_BLANKS 16
 

Function Documentation

◆ _entityDecode()

_entityDecode (   $text)

Definition at line 93 of file domxml-php4-to-php5.php.

93{return html_entity_decode(strtr($text,array('''=>'\'')),ENT_QUOTES,'UTF-8');}
$text

References $text.

Referenced by php4DOMNode\new_child(), and php4DOMNode\set_content().

+ Here is the caller graph for this function:

◆ _error_report()

_error_report (   $error)

Definition at line 94 of file domxml-php4-to-php5.php.

94 {return array('errormessage'=>$error->message,'nodename'=>'','line'=>$error->line,'col'=>$error->column)+($error->file==''?array():array('directory'=>dirname($error->file),'file'=>basename($error->file)));}
95class php4DOMAttr extends php4DOMNode
96{
97 function __get($name)
98 {
99 if ($name==='name') return $this->myDOMNode->name;
100 else return parent::__get($name);
101 }
102 function name() {return $this->myDOMNode->name;}
103 function set_content($text) {}
104 //function set_value($content) {return $this->myDOMNode->value=htmlspecialchars($content,ENT_QUOTES);}
105 function specified() {return $this->myDOMNode->specified;}
106 function value() {return $this->myDOMNode->value;}
107}
108class php4DOMDocument extends php4DOMNode
109{
111 {
112 $this->myDOMNode=new DOMDocument();
113 $this->myOwnerDocument=$this;
114 if ($mode & DOMXML_LOAD_VALIDATING) $this->myDOMNode->validateOnParse=true;
115 if ($mode & DOMXML_LOAD_RECOVERING) $this->myDOMNode->recover=true;
116 if ($mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) $this->myDOMNode->substituteEntities=true;
117 if ($mode & DOMXML_LOAD_DONT_KEEP_BLANKS) $this->myDOMNode->preserveWhiteSpace=false;
118 }
119 function add_root($name)
120 {
121 if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild);
122 return new php4DOMElement($this->myDOMNode->appendChild($this->myDOMNode->createElement($name)),$this->myOwnerDocument);
123 }
124 function create_attribute($name,$value)
125 {
126 $myAttr=$this->myDOMNode->createAttribute($name);
127 $myAttr->value=htmlspecialchars($value,ENT_QUOTES);
128 return new php4DOMAttr($myAttr,$this);
129 }
130 function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);}
131 function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data),$this);}
132 function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);}
133 function create_element_ns($uri,$name,$prefix=null)
134 {
135 if ($prefix==null) $prefix=$this->myDOMNode->lookupPrefix($uri);
136 if (($prefix==null)&&(($this->myDOMNode->documentElement==null)||(!$this->myDOMNode->documentElement->isDefaultNamespace($uri)))) $prefix='a'.sprintf('%u',crc32($uri));
137 return new php4DOMElement($this->myDOMNode->createElementNS($uri,$prefix==null ? $name : $prefix.':'.$name),$this);
138 }
139 function create_entity_reference($content) {return new php4DOMNode($this->myDOMNode->createEntityReference($content),$this);} //By Walter Ebert 2007-01-22
140 function create_processing_instruction($target,$data=''){return new php4DomProcessingInstruction($this->myDOMNode->createProcessingInstruction($target,$data),$this);}
141 function create_text_node($content) {return new php4DOMText($this->myDOMNode->createTextNode($content),$this);}
142 function document_element() { return parent::_newDOMElement($this->myDOMNode->documentElement,$this);}
143 function dump_file($filename,$compressionmode=false,$format=false)
144 {
145 $format0=$this->myDOMNode->formatOutput;
146 $this->myDOMNode->formatOutput=$format;
147 $res=$this->myDOMNode->save($filename);
148 $this->myDOMNode->formatOutput=$format0;
149 return $res;
150 }
151 function dump_mem($format=false,$encoding=false)
152 {
153 $format0=$this->myDOMNode->formatOutput;
154 $this->myDOMNode->formatOutput=$format;
155 $encoding0=$this->myDOMNode->encoding;
156 if ($encoding) $this->myDOMNode->encoding=$encoding;
157 $dump=$this->myDOMNode->saveXML();
158 $this->myDOMNode->formatOutput=$format0;
159 if ($encoding) $this->myDOMNode->encoding= $encoding0=='' ? 'UTF-8' : $encoding0; //UTF-8 is XML default encoding
160 return $dump;
161 }
162 function free()
163 {
164 if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild);
165 $this->myDOMNode=null;
166 $this->myOwnerDocument=null;
167 }
168 function get_element_by_id($id) {return parent::_newDOMElement($this->myDOMNode->getElementById($id),$this);}
169 function get_elements_by_tagname($name)
170 {
171 $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
172 $nodeSet=array();
173 $i=0;
174 if (isset($myDOMNodeList))
175 while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this);
176 return $nodeSet;
177 }
178 function html_dump_mem() {return $this->myDOMNode->saveHTML();}
179 function root() {return parent::_newDOMElement($this->myDOMNode->documentElement,$this);}
180 function xinclude() {return $this->myDOMNode->xinclude();}
181 function xpath_new_context() {return new php4DOMXPath($this);}
182}
183class php4DOMElement extends php4DOMNode
184{
185 function add_namespace($uri,$prefix)
186 {
187 if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/',$prefix)) return false;
188 else
189 {
190 $this->myDOMNode->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$prefix,$uri); //By Daniel Walker 2006-09-08
191 return true;
192 }
193 }
194 function get_attribute($name) {return $this->myDOMNode->getAttribute($name);}
195 function get_attribute_node($name) {return parent::_newDOMElement($this->myDOMNode->getAttributeNode($name),$this->myOwnerDocument);}
196 function get_elements_by_tagname($name)
197 {
198 $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
199 $nodeSet=array();
200 $i=0;
201 if (isset($myDOMNodeList))
202 while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
203 return $nodeSet;
204 }
205 function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);}
206 function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name);}
207 function set_attribute($name,$value)
208 {
209 //return $this->myDOMNode->setAttribute($name,$value); //Does not return a DomAttr
210 $myAttr=$this->myDOMNode->ownerDocument->createAttribute($name);
211 $myAttr->value=htmlspecialchars($value,ENT_QUOTES); //Entity problem reported by AL-DesignWorks 2007-09-07
212 $this->myDOMNode->setAttributeNode($myAttr);
213 return new php4DOMAttr($myAttr,$this->myOwnerDocument);
214 }
215 /*
216 function set_attribute_node($attr)
217 {
218 $this->myDOMNode->setAttributeNode($this->_importNode($attr));
219 return $attr;
220 }*/
221 function set_name($name)
222 {
223 if ($this->myDOMNode->prefix=='') $newNode=$this->myDOMNode->ownerDocument->createElement($name);
224 else $newNode=$this->myDOMNode->ownerDocument->createElementNS($this->myDOMNode->namespaceURI,$this->myDOMNode->prefix.':'.$name);
225 $myDOMNodeList=$this->myDOMNode->attributes;
226 $i=0;
227 if (isset($myDOMNodeList))
228 while ($node=$myDOMNodeList->item($i++))
229 if ($node->namespaceURI=='') $newNode->setAttribute($node->name,$node->value);
230 else $newNode->setAttributeNS($node->namespaceURI,$node->nodeName,$node->value);
231 $myDOMNodeList=$this->myDOMNode->childNodes;
232 if (isset($myDOMNodeList))
233 while ($node=$myDOMNodeList->item(0)) $newNode->appendChild($node);
234 $this->myDOMNode->parentNode->replaceChild($newNode,$this->myDOMNode);
235 $this->myDOMNode=$newNode;
236 return true;
237 }
238 function tagname() {return $this->tagname;}
239}
240class php4DOMNode
241{
242 public $myDOMNode;
243 public $myOwnerDocument;
244 function php4DOMNode($aDomNode,$aOwnerDocument)
245 {
246 $this->myDOMNode=$aDomNode;
247 $this->myOwnerDocument=$aOwnerDocument;
248 }
249 function __get($name)
250 {
251 switch ($name)
252 {
253 case 'type': return $this->myDOMNode->nodeType;
254 case 'tagname': return ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->tagName; //Avoid namespace prefix for DOMElement
255 case 'content': return $this->myDOMNode->textContent;
256 case 'value': return $this->myDOMNode->value;
257 default:
258 $myErrors=debug_backtrace();
259 trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE);
260 return false;
261 }
262 }
263 function add_child($newnode) {return append_child($newnode);}
264 function add_namespace($uri,$prefix) {return false;}
265 function append_child($newnode) {return self::_newDOMElement($this->myDOMNode->appendChild($this->_importNode($newnode)),$this->myOwnerDocument);}
266 function append_sibling($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->appendChild($this->_importNode($newnode)),$this->myOwnerDocument);}
267 function attributes()
268 {
269 $myDOMNodeList=$this->myDOMNode->attributes;
270 if (!(isset($myDOMNodeList)&&$this->myDOMNode->hasAttributes())) return null;
271 $nodeSet=array();
272 $i=0;
273 while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument);
274 return $nodeSet;
275 }
276 function child_nodes()
277 {
278 $myDOMNodeList=$this->myDOMNode->childNodes;
279 $nodeSet=array();
280 $i=0;
281 if (isset($myDOMNodeList))
282 while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=self::_newDOMElement($node,$this->myOwnerDocument);
283 return $nodeSet;
284 }
285 function children() {return $this->child_nodes();}
286 function clone_node($deep=false) {return self::_newDOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);}
287 //dump_node($node) should only be called on php4DOMDocument
288 function dump_node($node=null) {return $node==null ? $this->myOwnerDocument->myDOMNode->saveXML($this->myDOMNode) : $this->myOwnerDocument->myDOMNode->saveXML($node->myDOMNode);}
289 function first_child() {return self::_newDOMElement($this->myDOMNode->firstChild,$this->myOwnerDocument);}
290 function get_content() {return $this->myDOMNode->textContent;}
291 function has_attributes() {return $this->myDOMNode->hasAttributes();}
292 function has_child_nodes() {return $this->myDOMNode->hasChildNodes();}
293 function insert_before($newnode,$refnode) {return self::_newDOMElement($this->myDOMNode->insertBefore($this->_importNode($newnode),$refnode==null?null:$refnode->myDOMNode),$this->myOwnerDocument);}
294 function is_blank_node() {return ($this->myDOMNode->nodeType===XML_TEXT_NODE)&&preg_match('%^\s*$%',$this->myDOMNode->nodeValue);}
295 function last_child() {return self::_newDOMElement($this->myDOMNode->lastChild,$this->myOwnerDocument);}
296 function new_child($name,$content)
297 {
298 $mySubNode=$this->myDOMNode->ownerDocument->createElement($name);
299 $mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($content)));
300 $this->myDOMNode->appendChild($mySubNode);
301 return new php4DOMElement($mySubNode,$this->myOwnerDocument);
302 }
303 function next_sibling() {return self::_newDOMElement($this->myDOMNode->nextSibling,$this->myOwnerDocument);}
304 function node_name() {return ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->nodeName;} //Avoid namespace prefix for DOMElement
305 function node_type() {return $this->myDOMNode->nodeType;}
306 function node_value() {return $this->myDOMNode->nodeValue;}
307 function owner_document() {return $this->myOwnerDocument;}
308 function parent_node() {return self::_newDOMElement($this->myDOMNode->parentNode,$this->myOwnerDocument);}
309 function prefix() {return $this->myDOMNode->prefix;}
310 function previous_sibling() {return self::_newDOMElement($this->myDOMNode->previousSibling,$this->myOwnerDocument);}
311 function remove_child($oldchild) {return self::_newDOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode),$this->myOwnerDocument);}
312 function replace_child($newnode,$oldnode) {return self::_newDOMElement($this->myDOMNode->replaceChild($this->_importNode($newnode),$oldnode->myDOMNode),$this->myOwnerDocument);}
313 function replace_node($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->replaceChild($this->_importNode($newnode),$this->myDOMNode),$this->myOwnerDocument);}
314 function set_content($text) {return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($text)));} //Entity problem reported by AL-DesignWorks 2007-09-07
315 //function set_name($name) {return $this->myOwnerDocument->renameNode($this->myDOMNode,$this->myDOMNode->namespaceURI,$name);}
316 function set_namespace($uri,$prefix=null)
317 {//Contributions by Daniel Walker 2006-09-08
318 $nsprefix=$this->myDOMNode->lookupPrefix($uri);
319 if ($nsprefix==null)
320 {
321 $nsprefix= $prefix==null ? $nsprefix='a'.sprintf('%u',crc32($uri)) : $prefix;
322 if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE)
323 {
324 if (($prefix!=null)&&$this->myDOMNode->ownerElement->hasAttributeNS('http://www.w3.org/2000/xmlns/',$nsprefix)&&
325 ($this->myDOMNode->ownerElement->getAttributeNS('http://www.w3.org/2000/xmlns/',$nsprefix)!=$uri))
326 {//Remove namespace
327 $parent=$this->myDOMNode->ownerElement;
328 $parent->removeAttributeNode($this->myDOMNode);
329 $parent->setAttribute($this->myDOMNode->localName,$this->myDOMNode->nodeValue);
330 $this->myDOMNode=$parent->getAttributeNode($this->myDOMNode->localName);
331 return;
332 }
333 $this->myDOMNode->ownerElement->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$nsprefix,$uri);
334 }
335 }
336 if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE)
337 {
338 $parent=$this->myDOMNode->ownerElement;
339 $parent->removeAttributeNode($this->myDOMNode);
340 $parent->setAttributeNS($uri,$nsprefix.':'.$this->myDOMNode->localName,$this->myDOMNode->nodeValue);
341 $this->myDOMNode=$parent->getAttributeNodeNS($uri,$this->myDOMNode->localName);
342 }
343 elseif ($this->myDOMNode->nodeType===XML_ELEMENT_NODE)
344 {
345 $NewNode=$this->myDOMNode->ownerDocument->createElementNS($uri,$nsprefix.':'.$this->myDOMNode->localName);
346 foreach ($this->myDOMNode->attributes as $n) $NewNode->appendChild($n->cloneNode(true));
347 foreach ($this->myDOMNode->childNodes as $n) $NewNode->appendChild($n->cloneNode(true));
348 $xpath=new DOMXPath($this->myDOMNode->ownerDocument);
349 $myDOMNodeList=$xpath->query('namespace::*[name()!="xml"]',$this->myDOMNode); //Add old namespaces
350 foreach ($myDOMNodeList as $n) $NewNode->setAttributeNS('http://www.w3.org/2000/xmlns/',$n->nodeName,$n->nodeValue);
351 $this->myDOMNode->parentNode->replaceChild($NewNode,$this->myDOMNode);
352 $this->myDOMNode=$NewNode;
353 }
354 }
355 function unlink_node()
356 {
357 if ($this->myDOMNode->parentNode!=null)
358 {
359 if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode);
360 else $this->myDOMNode->parentNode->removeChild($this->myDOMNode);
361 }
362 }
363 protected function _importNode($newnode) {return $this->myOwnerDocument===$newnode->myOwnerDocument ? $newnode->myDOMNode : $this->myOwnerDocument->myDOMNode->importNode($newnode->myDOMNode,true);} //To import DOMNode from another DOMDocument
364 static function _newDOMElement($aDOMNode,$aOwnerDocument)
365 {//Check the PHP5 DOMNode before creating a new associated PHP4 DOMNode wrapper
366 if ($aDOMNode==null) return null;
367 switch ($aDOMNode->nodeType)
368 {
369 case XML_ELEMENT_NODE: return new php4DOMElement($aDOMNode,$aOwnerDocument);
370 case XML_TEXT_NODE: return new php4DOMText($aDOMNode,$aOwnerDocument);
371 case XML_ATTRIBUTE_NODE: return new php4DOMAttr($aDOMNode,$aOwnerDocument);
372 case XML_PI_NODE: return new php4DomProcessingInstruction($aDOMNode,$aOwnerDocument);
373 default: return new php4DOMNode($aDOMNode,$aOwnerDocument);
374 }
375 }
376}
378{
379 function data() {return $this->myDOMNode->data;}
380 function target() {return $this->myDOMNode->target;}
381}
382
383class php4DOMText extends php4DOMNode
384{
385 function __get($name)
386 {
387 if ($name==='tagname') return '#text';
388 else return parent::__get($name);
389 }
390 function tagname() {return '#text';}
391 function set_content($text) {$this->myDOMNode->nodeValue=$text; return true;}
392}
393
394if (!defined('XPATH_NODESET'))
395{
396 define('XPATH_UNDEFINED',0);
397 define('XPATH_NODESET',1);
398 define('XPATH_BOOLEAN',2);
399 define('XPATH_NUMBER',3);
400 define('XPATH_STRING',4);
401 /*define('XPATH_POINT',5);
402 define('XPATH_RANGE',6);
403 define('XPATH_LOCATIONSET',7);
404 define('XPATH_USERS',8);
405 define('XPATH_XSLT_TREE',9);*/
406}
407
408class php4DOMNodelist
409{
410 private $myDOMNodelist;
411 public $nodeset;
412 public $type=XPATH_UNDEFINED;
413 public $value;
414 function php4DOMNodelist($aDOMNodelist,$aOwnerDocument)
415 {
416 if (!isset($aDOMNodelist)) return;
417 elseif (is_object($aDOMNodelist)||is_array($aDOMNodelist))
418 {
419 if ($aDOMNodelist->length>0)
420 {
421 $this->myDOMNodelist=$aDOMNodelist;
422 $this->nodeset=array();
423 $this->type=XPATH_NODESET;
424 $i=0;
425 while ($node=$this->myDOMNodelist->item($i++)) $this->nodeset[]=php4DOMNode::_newDOMElement($node,$aOwnerDocument);
426 }
427 }
428 elseif (is_int($aDOMNodelist)||is_float($aDOMNodelist))
429 {
430 $this->type=XPATH_NUMBER;
431 $this->value=$aDOMNodelist;
432 }
433 elseif (is_bool($aDOMNodelist))
434 {
435 $this->type=XPATH_BOOLEAN;
436 $this->value=$aDOMNodelist;
437 }
438 elseif (is_string($aDOMNodelist))
439 {
440 $this->type=XPATH_STRING;
441 $this->value=$aDOMNodelist;
442 }
443 }
444}
445
446class php4DOMXPath
447{
448 public $myDOMXPath;
449 private $myOwnerDocument;
450 function php4DOMXPath($dom_document)
451 {
452 //TODO: If $dom_document is a DomElement, make that default $contextnode and modify XPath. Ex: '/test'
453 $this->myOwnerDocument=$dom_document->myOwnerDocument;
454 $this->myDOMXPath=new DOMXPath($this->myOwnerDocument->myDOMNode);
455 }
456 function xpath_eval($eval_str,$contextnode=null)
457 {
458 if (method_exists($this->myDOMXPath,'evaluate')) $xp=isset($contextnode) ? $this->myDOMXPath->evaluate($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->evaluate($eval_str);
459 else $xp=isset($contextnode) ? $this->myDOMXPath->query($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->query($eval_str);
460 $xp=new php4DOMNodelist($xp,$this->myOwnerDocument);
461 return ($xp->type===XPATH_UNDEFINED) ? false : $xp;
462 }
463 function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);}
464}
465
466if (extension_loaded('xsl'))
467{//See also: http://alexandre.alapetite.net/doc-alex/xslt-php4-php5/
468 function domxml_xslt_stylesheet($xslstring) {return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring));}
469 function domxml_xslt_stylesheet_doc($dom_document) {return new php4DomXsltStylesheet($dom_document);}
470 function domxml_xslt_stylesheet_file($xslfile) {return new php4DomXsltStylesheet(DOMDocument::load($xslfile));}
471 class php4DomXsltStylesheet
472 {
473 private $myxsltProcessor;
474 function php4DomXsltStylesheet($dom_document)
475 {
476 $this->myxsltProcessor=new xsltProcessor();
477 $this->myxsltProcessor->importStyleSheet($dom_document);
478 }
479 function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false)
480 {
481 foreach ($xslt_parameters as $param=>$value) $this->myxsltProcessor->setParameter('',$param,$value);
482 $myphp4DOMDocument=new php4DOMDocument();
483 $myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode);
484 return $myphp4DOMDocument;
485 }
486 function result_dump_file($dom_document,$filename)
487 {
488 $html=$dom_document->myDOMNode->saveHTML();
489 file_put_contents($filename,$html);
490 return $html;
491 }
492 function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML();}
493 }
494}
$n
Definition: RandomTest.php:80
$filename
Definition: buildRTE.php:89
create_processing_instruction($target, $data='')
create_cdata_section($content)
create_entity_reference($content)
dump_mem($format=false, $encoding=false)
create_element_ns($uri, $name, $prefix=null)
create_attribute($name, $value)
dump_file($filename, $compressionmode=false, $format=false)
php4DOMDocument($source, $file=true)
set_attribute($name, $value)
add_namespace($uri, $prefix)
set_namespace($uri, $prefix=null)
clone_node($deep=false)
static _newDOMElement($aDOMNode, $aOwnerDocument)
remove_child($oldchild)
add_namespace($uri, $prefix)
dump_node($node=null)
php4DOMNode($aDomNode)
replace_node($newnode)
new_child($name, $content)
replace_child($oldnode, $newnode)
insert_before($newnode, $refnode)
append_sibling($newnode)
append_child($newnode)
php4DOMNodelist($aDOMNodelist)
xpath_eval($eval_str)
php4DOMXPath($dom_document)
xpath_register_ns($prefix, $namespaceURI)
const DOMXML_LOAD_SUBSTITUTE_ENTITIES
const DOMXML_LOAD_RECOVERING
const DOMXML_LOAD_DONT_KEEP_BLANKS
const DOMXML_LOAD_VALIDATING
const DOMXML_LOAD_PARSING
_entityDecode($text)
$html
Definition: example_001.php:87
$data

◆ domxml_new_doc()

domxml_new_doc (   $version)

Definition at line 52 of file domxml-php4-to-php5.php.

52{return new php4DOMDocument();}

◆ domxml_new_xmldoc()

domxml_new_xmldoc (   $version)

Definition at line 53 of file domxml-php4-to-php5.php.

53{return new php4DOMDocument();}

◆ domxml_open_file()

domxml_open_file (   $filename,
  $mode = DOMXML_LOAD_PARSING,
$error = null 
)

Definition at line 54 of file domxml-php4-to-php5.php.

55{
56 $dom=new php4DOMDocument($mode);
57 $errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION');
58 if ($errorMode) libxml_use_internal_errors(true);
59 if (!$dom->myDOMNode->load($filename)) $dom=null;
60 if ($errorMode)
61 {
62 $error=array_map('_error_report',libxml_get_errors());
63 libxml_clear_errors();
64 }
65 return $dom;
66}

References $filename.

Referenced by xmldocfile().

+ Here is the caller graph for this function:

◆ domxml_open_mem()

domxml_open_mem (   $str,
  $mode = DOMXML_LOAD_PARSING,
$error = null 
)

Definition at line 67 of file domxml-php4-to-php5.php.

68{
69 $dom=new php4DOMDocument($mode);
70 $errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION');
71 if ($errorMode) libxml_use_internal_errors(true);
72 if (!$dom->myDOMNode->loadXML($str)) $dom=null;
73 if ($errorMode)
74 {
75 $error=array_map('_error_report',libxml_get_errors());
76 libxml_clear_errors();
77 }
78 return $dom;
79}

Referenced by xmldoc().

+ Here is the caller graph for this function:

◆ html_doc()

html_doc (   $html_doc,
  $from_file = false 
)

Definition at line 80 of file domxml-php4-to-php5.php.

81{
82 $dom=new php4DOMDocument();
83 if ($from_file) $result=$dom->myDOMNode->loadHTMLFile($html_doc);
84 else $result=$dom->myDOMNode->loadHTML($html_doc);
85 return $result ? $dom : null;
86}
$result

References $result.

Referenced by html_doc_file().

+ Here is the caller graph for this function:

◆ html_doc_file()

html_doc_file (   $filename)

Definition at line 87 of file domxml-php4-to-php5.php.

87{return html_doc($filename,true);}
html_doc($html_doc, $from_file=false)

References $filename, and html_doc().

+ Here is the call graph for this function:

◆ xmldoc()

xmldoc (   $str)

Definition at line 88 of file domxml-php4-to-php5.php.

88{return domxml_open_mem($str);}
domxml_open_mem($str, $mode=DOMXML_LOAD_PARSING, &$error=null)

References domxml_open_mem().

+ Here is the call graph for this function:

◆ xmldocfile()

xmldocfile (   $filename)

Definition at line 89 of file domxml-php4-to-php5.php.

domxml_open_file($filename, $mode=DOMXML_LOAD_PARSING, &$error=null)

References $filename, and domxml_open_file().

+ Here is the call graph for this function:

◆ xpath_eval()

xpath_eval (   $xpath_context,
  $eval_str,
  $contextnode = null 
)

Definition at line 90 of file domxml-php4-to-php5.php.

90{return $xpath_context->xpath_eval($eval_str,$contextnode);}

◆ xpath_new_context()

xpath_new_context (   $dom_document)

Definition at line 91 of file domxml-php4-to-php5.php.

91{return new php4DOMXPath($dom_document);}

◆ xpath_register_ns()

xpath_register_ns (   $xpath_context,
  $prefix,
  $namespaceURI 
)

Definition at line 92 of file domxml-php4-to-php5.php.

92{return $xpath_context->myDOMXPath->registerNamespace($prefix,$namespaceURI);}

Referenced by Auth_Yadis_domxml\registerNamespace().

+ Here is the caller graph for this function:

Variable Documentation

◆ DOMXML_LOAD_DONT_KEEP_BLANKS

const DOMXML_LOAD_DONT_KEEP_BLANKS 16

Definition at line 50 of file domxml-php4-to-php5.php.

Referenced by php4DOMDocument\php4DOMDocument().

◆ DOMXML_LOAD_PARSING

◆ DOMXML_LOAD_RECOVERING

const DOMXML_LOAD_RECOVERING 2

Definition at line 47 of file domxml-php4-to-php5.php.

Referenced by php4DOMDocument\php4DOMDocument().

◆ DOMXML_LOAD_SUBSTITUTE_ENTITIES

const DOMXML_LOAD_SUBSTITUTE_ENTITIES 4

Definition at line 48 of file domxml-php4-to-php5.php.

Referenced by php4DOMDocument\php4DOMDocument().

◆ DOMXML_LOAD_VALIDATING