當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DOMNode::Dump方法代碼示例

本文整理匯總了PHP中DOMNode::Dump方法的典型用法代碼示例。如果您正苦於以下問題:PHP DOMNode::Dump方法的具體用法?PHP DOMNode::Dump怎麽用?PHP DOMNode::Dump使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DOMNode的用法示例。


在下文中一共展示了DOMNode::Dump方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: MergeInto

 /**
  * Merge the current node into the given container
  * 	 
  * @param DOMNode $oContainer An element or a document	 
  * @param string  $sSearchId  The id to consider (could be blank)
  * @param bool    $bMustExist Throw an exception if the node must already be found (and not marked as deleted!)
  */
 public function MergeInto($oContainer, $sSearchId, $bMustExist)
 {
     $oTargetNode = $oContainer->_FindChildNode($this, $sSearchId);
     if ($oTargetNode) {
         if ($oTargetNode->getAttribute('_alteration') == 'removed') {
             if ($bMustExist) {
                 throw new Exception(MFDocument::GetItopNodePath($this) . ' at line ' . $this->getLineNo() . ": could not be found (marked as deleted)");
             }
             // Beware: ImportNode(xxx, false) DOES NOT copy the node's attribute on *some* PHP versions (<5.2.17)
             // So use this workaround to import a node and its attributes on *any* PHP version
             $oTargetNode = $oContainer->ownerDocument->ImportNode($this->cloneNode(false), true);
             $oContainer->AddChildNode($oTargetNode);
         }
     } else {
         if ($bMustExist) {
             echo "Dumping parent node<br/>\n";
             $oContainer->Dump();
             throw new Exception(MFDocument::GetItopNodePath($this) . ' at line ' . $this->getLineNo() . ": could not be found");
         }
         // Beware: ImportNode(xxx, false) DOES NOT copy the node's attribute on *some* PHP versions (<5.2.17)
         // So use this workaround to import a node and its attributes on *any* PHP version
         $oTargetNode = $oContainer->ownerDocument->ImportNode($this->cloneNode(false), true);
         $oContainer->AddChildNode($oTargetNode);
     }
     return $oTargetNode;
 }
開發者ID:besmirzanaj,項目名稱:itop-code,代碼行數:33,代碼來源:modelfactory.class.inc.php

示例2: MergeInto

 /**
  * Merge the current node into the given container
  * 	 
  * @param DOMNode $oContainer An element or a document	 
  * @param string  $sSearchId  The id to consider (could be blank)
  * @param bool    $bMustExist Throw an exception if the node must already be found (and not marked as deleted!)
  */
 public function MergeInto($oContainer, $sSearchId, $bMustExist)
 {
     $oTargetNode = $oContainer->_FindChildNode($this, $sSearchId);
     if ($oTargetNode) {
         if ($oTargetNode->getAttribute('_alteration') == 'removed') {
             if ($bMustExist) {
                 throw new Exception("found mandatory node {$this->tagName}(id:{$sSearchId}) marked as deleted in " . $oContainer->getNodePath());
             }
             // Beware: ImportNode(xxx, false) DOES NOT copy the node's attribute on *some* PHP versions (<5.2.17)
             // So use this workaround to import a node and its attributes on *any* PHP version
             $oTargetNode = $oContainer->ownerDocument->ImportNode($this->cloneNode(false), true);
             $oContainer->AddChildNode($oTargetNode);
         }
     } else {
         if ($bMustExist) {
             echo "Dumping parent node<br/>\n";
             $oContainer->Dump();
             throw new Exception("could not find {$this->tagName}(id:{$sSearchId}) in " . $oContainer->getNodePath());
         }
         // Beware: ImportNode(xxx, false) DOES NOT copy the node's attribute on *some* PHP versions (<5.2.17)
         // So use this workaround to import a node and its attributes on *any* PHP version
         $oTargetNode = $oContainer->ownerDocument->ImportNode($this->cloneNode(false), true);
         $oContainer->AddChildNode($oTargetNode);
     }
     return $oTargetNode;
 }
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:33,代碼來源:modelfactory.class.inc.php


注:本文中的DOMNode::Dump方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。