当前位置: 首页>>代码示例>>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;未经允许,请勿转载。