• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/CAS/phpcas/source/CAS/domxml-php4-php5.php

Go to the documentation of this file.
00001 <?php
00037         // new
00038         function domxml_new_doc($version)
00039         {
00040 echo "-1";
00041                 return new php4DOMDocument('');
00042         }
00043         
00044         // same
00045         function domxml_open_file($filename)
00046         {
00047 echo "-2";
00048                 return new php4DOMDocument($filename);
00049         }
00050         
00051         // different
00052         function domxml_open_mem($str)
00053         {
00054 echo "-3";
00055                  $dom=new php4DOMDocument('');
00056                  $dom->myDOMNode->loadXML($str);
00057                  return $dom;
00058         }
00059         
00060         // different -> adapted in ilias
00061         function xpath_eval($xpath_context,$eval_str,$contextnode=null)
00062         {
00063 echo "-4";
00064                 return $xpath_context->query($eval_str,$contextnode);
00065         }
00066         
00067         // same
00068         function xpath_new_context($dom_document)
00069         {
00070 echo "-5";
00071                 return new php4DOMXPath($dom_document);
00072         }
00073 
00074 // same (nearly)
00075 class php4DOMAttr extends php4DOMNode
00076 {
00077         function php4DOMAttr($aDOMAttr) {
00078 echo "-6";
00079                 $this->myDOMNode=$aDOMAttr;
00080         }
00081         
00082         function Name() {
00083 echo "-7";
00084                 return $this->myDOMNode->name;
00085         }
00086         
00087         function Specified() {
00088 echo "-8";
00089                 return $this->myDOMNode->specified;
00090         }
00091         
00092         function Value() {
00093 echo "-9";
00094                 return $this->myDOMNode->value;
00095         }
00096 }
00097 
00098 // different
00099 class php4DOMDocument extends php4DOMNode
00100 {
00101         // different
00102         function php4DOMDocument($filename='')
00103         {
00104 echo "-A";
00105                 $this->myDOMNode=new DOMDocument();
00106                 if ($filename!='') $this->myDOMNode->load($filename);
00107         }
00108 
00109         // different (a little)
00110         function create_attribute($name,$value)
00111         {
00112 echo "-B";
00113                 $myAttr=$this->myDOMNode->createAttribute($name);
00114                 $myAttr->value=$value;
00115                 return new php4DOMAttr($myAttr,$this);
00116         }
00117         
00118         // different (little)
00119         function create_cdata_section($content)
00120         {
00121 echo "-C";
00122                 return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);
00123         }
00124         
00125         // different (little)
00126         function create_comment($data)
00127         {
00128 echo "-D";
00129                 return new php4DOMNode($this->myDOMNode->createComment($data),$this);
00130         }
00131         
00132         // different (little)
00133         function create_element($name)
00134         {
00135 echo "-E";
00136                 return new php4DOMElement($this->myDOMNode->createElement($name),$this);
00137         }
00138         
00139         function create_text_node($content)
00140         {
00141 echo "-F";
00142                 return new php4DOMNode($this->myDOMNode->createTextNode($content),$this);
00143         }
00144         
00145         function document_element()
00146         {
00147 echo "-G";
00148                 return new php4DOMElement($this->myDOMNode->documentElement,$this);
00149         }
00150         
00151         function dump_file($filename,$compressionmode=false,$format=false)
00152         {
00153 echo "-H";
00154                 return $this->myDOMNode->save($filename);
00155         }
00156         
00157         function dump_mem($format=false,$encoding=false)
00158         {
00159 echo "-I";
00160                 return $this->myDOMNode->saveXML();
00161         }
00162         
00163         function get_element_by_id($id)
00164         {
00165 echo "-J";
00166                 return new php4DOMElement($this->myDOMNode->getElementById($id),$this);
00167         }
00168         
00169         function get_elements_by_tagname($name)
00170         {
00171 echo "-K";
00172                 $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
00173                 $nodeSet=array();
00174                 $i=0;
00175                 if (isset($myDOMNodeList))
00176                 while ($node=$myDOMNodeList->item($i))
00177                 {
00178                         $nodeSet[]=new php4DOMElement($node,$this);
00179                         $i++;
00180                 }
00181                 return $nodeSet;
00182         }
00183         
00184         function html_dump_mem()
00185         {
00186 echo "-L";
00187                 return $this->myDOMNode->saveHTML();
00188         }
00189         
00190         function root()
00191         {
00192 echo "-M";
00193                 return new php4DOMElement($this->myDOMNode->documentElement,$this);
00194         }
00195 }
00196 
00197 class php4DOMElement extends php4DOMNode
00198 {
00199         function get_attribute($name)
00200         {
00201 echo "-N";
00202                 return $this->myDOMNode->getAttribute($name);
00203         }
00204         
00205         function get_elements_by_tagname($name)
00206         {
00207 echo "-O";
00208                 $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
00209                 $nodeSet=array();
00210                 $i=0;
00211                 if (isset($myDOMNodeList))
00212                 while ($node=$myDOMNodeList->item($i))
00213                 {
00214                         $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
00215                         $i++;
00216                 }
00217                 return $nodeSet;
00218         }
00219         
00220          function has_attribute($name)
00221          {
00222 echo "-P";
00223                 return $this->myDOMNode->hasAttribute($name);
00224          }
00225          
00226          function remove_attribute($name)
00227          {
00228 echo "-Q";
00229                 return $this->myDOMNode->removeAttribute($name);
00230          }
00231          
00232          function set_attribute($name,$value)
00233          {
00234 echo "-R";
00235                 return $this->myDOMNode->setAttribute($name,$value);
00236          }
00237          
00238          function tagname()
00239          {
00240 echo "-S";
00241                 return $this->myDOMNode->tagName;
00242          }
00243 }
00244 
00245 class php4DOMNode
00246 {
00247  var $myDOMNode;
00248  var $myOwnerDocument;
00249  
00250          function php4DOMNode($aDomNode,$aOwnerDocument)
00251          {
00252 echo "-T";
00253                 $this->myDOMNode=$aDomNode;
00254                 $this->myOwnerDocument=$aOwnerDocument;
00255          }
00256          
00257         function __get($name)
00258         {
00259 echo "-U";
00260                 if ($name=='type') return $this->myDOMNode->nodeType;
00261                 elseif ($name=='tagname') return $this->myDOMNode->tagName;
00262                 elseif ($name=='content') return $this->myDOMNode->textContent;
00263                 else
00264                 {
00265                 $myErrors=debug_backtrace();
00266                 trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE);
00267                 return false;
00268                 }
00269         }
00270 
00271         function append_child($newnode)
00272         {
00273 echo "-V";
00274                 return new php4DOMElement($this->myDOMNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);
00275         }
00276         
00277         function append_sibling($newnode)
00278         {
00279 echo "-W";
00280                 return new php4DOMElement($this->myDOMNode->parentNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);
00281         }
00282         
00283         function attributes()
00284         {
00285 echo "-X";
00286                 $myDOMNodeList=$this->myDOMNode->attributes;
00287                 $nodeSet=array();
00288                 $i=0;
00289                 if (isset($myDOMNodeList))
00290                 while ($node=$myDOMNodeList->item($i))
00291                 {
00292                         $nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument);
00293                         $i++;
00294                 }
00295                 return $nodeSet;
00296         }
00297         
00298         function child_nodes()
00299         {
00300 echo "-Y";
00301                 $myDOMNodeList=$this->myDOMNode->childNodes;
00302                 $nodeSet=array();
00303                 $i=0;
00304                 if (isset($myDOMNodeList))
00305                 while ($node=$myDOMNodeList->item($i))
00306                 {
00307                         $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
00308                         $i++;
00309                 }
00310                 return $nodeSet;
00311         }
00312         
00313         function children() {
00314 echo "-Z";
00315                 return $this->child_nodes();
00316         }
00317         
00318         function clone_node($deep=false) {
00319 echo "-a";
00320                 return new php4DOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);
00321         }
00322         
00323         function first_child() {
00324 echo "-b";
00325                 return new php4DOMElement($this->myDOMNode->firstChild,$this->myOwnerDocument);
00326         }
00327         function get_content() {
00328 echo "-c";
00329                 return $this->myDOMNode->textContent;
00330         }
00331         
00332         function has_attributes() {
00333 echo "-d";
00334                 return $this->myDOMNode->hasAttributes();
00335         }
00336         function has_child_nodes()
00337         {
00338 echo "-e";
00339                 return $this->myDOMNode->hasChildNodes();
00340         }
00341         function insert_before($newnode,$refnode)
00342         {
00343 echo "-f";
00344                 return new php4DOMElement($this->myDOMNode->insertBefore($newnode->myDOMNode,$refnode->myDOMNode),$this->myOwnerDocument);
00345         }
00346         
00347         function is_blank_node()
00348         {
00349 echo "-g";
00350                 $myDOMNodeList=$this->myDOMNode->childNodes;
00351                 $i=0;
00352                 if (isset($myDOMNodeList))
00353                 while ($node=$myDOMNodeList->item($i))
00354                 {
00355                 if (($node->nodeType==XML_ELEMENT_NODE)||
00356                 (($node->nodeType==XML_TEXT_NODE)&&!ereg('^([[:cntrl:]]|[[:space:]])*$',$node->nodeValue)))
00357                 return false;
00358                 $i++;
00359                 }
00360                 return true;
00361         }
00362         
00363         function last_child() {
00364 echo "-h";
00365                 return new php4DOMElement($this->myDOMNode->lastChild,$this->myOwnerDocument);
00366         }
00367         
00368         function new_child($name,$content)
00369         {
00370 echo "-i";
00371                 $mySubNode=$this->myDOMNode->ownerDocument->createElement($name);
00372                 $mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($content));
00373                 $this->myDOMNode->appendChild($mySubNode);
00374                 return new php4DOMElement($mySubNode,$this->myOwnerDocument);
00375         }
00376         
00377         function next_sibling() {
00378 echo "-j";
00379                 return new php4DOMElement($this->myDOMNode->nextSibling,$this->myOwnerDocument);
00380         }
00381         
00382         function node_name() {
00383 echo "-k";
00384                 return $this->myDOMNode->localName;
00385         }
00386         
00387         function node_type() {
00388 echo "-l";
00389                 return $this->myDOMNode->nodeType;
00390         }
00391         
00392         function node_value()
00393         {
00394 echo "-m";
00395                 return $this->myDOMNode->nodeValue;
00396         }
00397         
00398         function owner_document()
00399         {
00400 echo "-n";
00401                 return $this->myOwnerDocument;
00402         }
00403         
00404         function parent_node() {
00405 echo "-o";
00406                 return new php4DOMElement($this->myDOMNode->parentNode,$this->myOwnerDocument);
00407         }
00408         
00409         function prefix() {
00410 echo "-p";
00411                 return $this->myDOMNode->prefix;
00412         }
00413         
00414         function previous_sibling() {
00415 echo "-q";
00416                 return new php4DOMElement($this->myDOMNode->previousSibling,$this->myOwnerDocument);
00417         }
00418         
00419         function remove_child($oldchild)
00420         {
00421 echo "-r";
00422                 return new php4DOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode),$this->myOwnerDocument);
00423         }
00424         
00425         function replace_child($oldnode,$newnode) {
00426 echo "-s";
00427                 return new php4DOMElement($this->myDOMNode->replaceChild($oldnode->myDOMNode,$newnode->myDOMNode),$this->myOwnerDocument);
00428         }
00429         
00430         function set_content($text)
00431         {
00432 echo "-t";
00433                 if (($this->myDOMNode->hasChildNodes())&&($this->myDOMNode->firstChild->nodeType==XML_TEXT_NODE))
00434                 $this->myDOMNode->removeChild($this->myDOMNode->firstChild);
00435                 return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($text));
00436         }
00437 }
00438 
00439 class php4DOMNodelist
00440 {
00441  var $myDOMNodelist;
00442  var $nodeset;
00443  
00444         function php4DOMNodelist($aDOMNodelist,$aOwnerDocument)
00445         {
00446 echo "-u";
00447                 $this->myDOMNodelist=$aDOMNodelist;
00448                 $this->nodeset=array();
00449                 $i=0;
00450                 if (isset($this->myDOMNodelist))
00451                 while ($node=$this->myDOMNodelist->item($i))
00452                 {
00453                 $this->nodeset[]=new php4DOMElement($node,$aOwnerDocument);
00454                 $i++;
00455                 }
00456         }
00457 }
00458 
00459 class php4DOMXPath
00460 {
00461  var $myDOMXPath;
00462  var $myOwnerDocument;
00463         function php4DOMXPath($dom_document)
00464         {
00465 echo "-v";
00466                 $this->myOwnerDocument=$dom_document;
00467                 $this->myDOMXPath=new DOMXPath($dom_document->myDOMNode);
00468         }
00469         
00470         function query($eval_str,$contextnode)
00471         {
00472 echo "-w";
00473                 if (isset($contextnode)) return new php4DOMNodelist($this->myDOMXPath->query($eval_str,$contextnode->myDOMNode),$this->myOwnerDocument);
00474                 else return new php4DOMNodelist($this->myDOMXPath->query($eval_str),$this->myOwnerDocument);
00475         }
00476  
00477         function xpath_register_ns($prefix,$namespaceURI)
00478         {
00479 echo "-x";
00480                 return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);
00481         }
00482 }
00483 
00484 if (extension_loaded('xsl'))
00485 {//See also: http://alexandre.alapetite.net/doc-alex/xslt-php4-php5/
00486         
00487         function domxml_xslt_stylesheet($xslstring)
00488         {
00489 echo "-y";
00490                 return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring));
00491         }
00492         
00493         function domxml_xslt_stylesheet_doc($dom_document) {
00494 echo "-z";
00495                 return new php4DomXsltStylesheet($dom_document);
00496         }
00497         
00498  function domxml_xslt_stylesheet_file($xslfile) {
00499 echo "-Ä";
00500         return new php4DomXsltStylesheet(DOMDocument::load($xslfile));
00501  }
00502 
00503  class php4DomXsltStylesheet
00504  {
00505   var $myxsltProcessor;
00506         function php4DomXsltStylesheet($dom_document)
00507         {
00508 echo "-Ö";
00509                 $this->myxsltProcessor=new xsltProcessor();
00510                 $this->myxsltProcessor->importStyleSheet($dom_document);
00511         }
00512         
00513         function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false)
00514         {
00515 echo "-Ü";
00516                 foreach ($xslt_parameters as $param=>$value)
00517                 $this->myxsltProcessor->setParameter('',$param,$value);
00518                 $myphp4DOMDocument=new php4DOMDocument();
00519                 $myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode);
00520                 return $myphp4DOMDocument;
00521         }
00522         
00523         function result_dump_file($dom_document,$filename)
00524         {
00525 echo "-ä";
00526                 $html=$dom_document->myDOMNode->saveHTML();
00527                 file_put_contents($filename,$html);
00528                 return $html;
00529         }
00530         
00531         function result_dump_mem($dom_document) {
00532 echo "-ö";
00533                 return $dom_document->myDOMNode->saveHTML();
00534         }
00535  }
00536 }
00537 
00538 ?>

Generated on Fri Dec 13 2013 17:56:55 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1