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


PHP DomDocument::xinclude方法代碼示例

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


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

示例1: load

 /**
  * Read from file
  */
 function load(&$ctx)
 {
     $dom = new DomDocument();
     $dom->load($this->path);
     $dom->xinclude();
     $this->xml = simplexml_import_dom($dom);
 }
開發者ID:twomice,項目名稱:civix,代碼行數:10,代碼來源:XML.php

示例2: parse

 /**
  * @param string $file
  *   Path to input.
  *
  * @return SimpleXMLElement|bool
  */
 public static function parse($file)
 {
     $dom = new DomDocument();
     $dom->load($file);
     $dom->xinclude();
     $xml = simplexml_import_dom($dom);
     return $xml;
 }
開發者ID:FundingWorks,項目名稱:civicrm-core,代碼行數:14,代碼來源:Xml.php

示例3: run

 /**
  * Import custom-data from an XML file
  *
  * @param string $file
  *   Path to an XML file.
  * @throws CRM_Core_Exception
  * @return void;
  */
 public function run($file)
 {
     // read xml file
     $dom = new DomDocument();
     if (!$dom->load($file)) {
         throw new CRM_Core_Exception("Failed to parse XML file \"{$file}\"");
     }
     $dom->xinclude();
     $xml = simplexml_import_dom($dom);
     return $this->runXmlElement($xml);
 }
開發者ID:kidaa30,項目名稱:yes,代碼行數:19,代碼來源:Import.php

示例4: generateXMLDom

 /**
  * Take the given $xml and turn it into a DomDocument and do the xincludes
  *
  * @param string $xml
  * @param string $xmlFilePath
  *
  * @return DomDocument
  */
 private function generateXMLDom($xml, $xmlFilePath = null)
 {
     $dom = new DomDocument();
     if (null !== $xmlFilePath) {
         $dom->documentURI = $xmlFilePath;
     }
     try {
         $dom->loadXML($xml);
     } catch (FrameEx $ex) {
         throw new FrameEx("Could not create DOM with xml\n\n: " . $xml);
     }
     $dom->xinclude();
     return $dom;
 }
開發者ID:Acidburn0zzz,項目名稱:xframe-legacy,代碼行數:22,代碼來源:Transformation.php

示例5: retrieve

 function retrieve($caseType)
 {
     $caseType = self::mungeCaseType($caseType);
     if (!CRM_Utils_Array::value($caseType, self::$_xml)) {
         if (!self::$_xml) {
             self::$_xml = array();
         }
         // first check custom templates directory
         $fileName = NULL;
         $config = CRM_Core_Config::singleton();
         if (isset($config->customTemplateDir) && $config->customTemplateDir) {
             // check if the file exists in the custom templates directory
             $fileName = implode(DIRECTORY_SEPARATOR, array($config->customTemplateDir, 'CRM', 'Case', 'xml', 'configuration', "{$caseType}.xml"));
         }
         if (!$fileName || !file_exists($fileName)) {
             // check if file exists locally
             $fileName = implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'xml', 'configuration', "{$caseType}.xml"));
             if (!file_exists($fileName)) {
                 // check if file exists locally
                 $fileName = implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'xml', 'configuration.sample', "{$caseType}.xml"));
             }
             if (!file_exists($fileName)) {
                 if (self::$_hookCache === NULL) {
                     self::$_hookCache = array();
                     CRM_Utils_Hook::caseTypes(self::$_hookCache);
                 }
                 if (isset(self::$_hookCache[$caseType], self::$_hookCache[$caseType]['file'])) {
                     $fileName = self::$_hookCache[$caseType]['file'];
                 }
             }
             if (!file_exists($fileName)) {
                 return FALSE;
             }
         }
         // read xml file
         $dom = new DomDocument();
         $dom->load($fileName);
         $dom->xinclude();
         self::$_xml[$caseType] = simplexml_import_dom($dom);
     }
     return self::$_xml[$caseType];
 }
開發者ID:hguru,項目名稱:224Civi,代碼行數:42,代碼來源:XMLProcessor.php

示例6: mocktest

 public function mocktest(&$caseTypes)
 {
     $paramsAct = array('option_group_id' => 2, 'version' => 3);
     $resultAct = civicrm_api3('activity_type', 'get', $paramsAct);
     if (in_array("Open Case", $resultAct['values'])) {
         $activityIdd = array_search('Open Case', $resultAct['values']);
         $paramsAct1 = array('option_group_id' => 2, 'version' => 3, 'id' => 18);
         $resultAct1 = civicrm_api3('option_value', 'delete', $paramsAct1);
     }
     $import = new CRM_Utils_Migrate_Import();
     $path = __DIR__ . '/Hrdata.xml';
     $dom = new DomDocument();
     $dom->load($path);
     $dom->xinclude();
     $xml = simplexml_import_dom($dom);
     $caseTypeName = $xml->name;
     $proc = new CRM_Case_XMLProcessor();
     $caseTypesGroupId = civicrm_api3('OptionGroup', 'getvalue', array('name' => 'case_type', 'return' => 'id'));
     if (!is_numeric($caseTypesGroupId)) {
         throw new CRM_Core_Exception("Found invalid ID for OptionGroup (case_type)");
     }
     // Create case type with 'Program Hiring Process'
     $paramsCaseType = array('option_group_id' => $caseTypesGroupId, 'version' => 3, 'name' => $caseTypeName, 'label' => $caseTypeName);
     $resultCaseType = civicrm_api3('option_value', 'create', $paramsCaseType);
     $this->casetype_id = $resultCaseType['values'][$resultCaseType['id']]['value'];
     $activitytype = $xml->ActivityTypes->ActivityType;
     foreach ($activitytype as $key => $val) {
         $activitytypename = (array) $val->name;
         $params = array('weight' => '2', 'label' => $activitytypename[0], 'name' => $activitytypename[0], 'filter' => 0, 'is_active' => 1, 'is_optgroup' => 1, 'is_default' => 0);
         $result = civicrm_api3('activity_type', 'create', $params);
         $this->activityIds[$result['values'][$result['id']]['name']] = $result['values'][$result['id']]['value'];
         //get id of open case activity type
         if ($activitytypename[0] == "Open Case") {
             $paramsAct = array('option_group_id' => 2, 'version' => 3);
             $resultAct = civicrm_api3('activity_type', 'get', $paramsAct);
             $this->opencase_activityId = array_search('Open Case', $resultAct['values']);
         }
     }
 }
開發者ID:JoeMurray,項目名稱:civihr,代碼行數:39,代碼來源:HRCaseUtilsPipelineTest.php

示例7: process

 /**
  * Try to process the Xinclude transformation
  *
  * @param   string  XML to process.
  *
  * @throws BuildException   On errors
  */
 protected function process($xml)
 {
     if ($this->basedir) {
         $cwd = getcwd();
         chdir($this->basedir);
     }
     // Create and setup document.
     $xmlDom = new DomDocument();
     $xmlDom->resolveExternals = $this->resolveExternals;
     $xmlDom->loadXML($xml);
     $xmlDom->xinclude();
     if ($this->basedir) {
         chdir($cwd);
     }
     return $xmlDom->saveXML();
 }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:23,代碼來源:XincludeFilter.php

示例8: retrieveFile

 /**
  * @param string $caseType
  * @return SimpleXMLElement|FALSE
  */
 public function retrieveFile($caseType)
 {
     $fileName = NULL;
     $fileXml = NULL;
     if (CRM_Case_BAO_CaseType::isValidName($caseType)) {
         // Search for a file based directly on the $caseType name
         $fileName = $this->findXmlFile($caseType);
     }
     // For backward compatibility, also search for double-munged file names
     // TODO In 4.6 or 5.0, remove support for loading double-munged file names
     if (!$fileName || !file_exists($fileName)) {
         $fileName = $this->findXmlFile(CRM_Case_XMLProcessor::mungeCaseType($caseType));
     }
     if ($fileName && file_exists($fileName)) {
         // read xml file
         $dom = new DomDocument();
         $dom->load($fileName);
         $dom->xinclude();
         $fileXml = simplexml_import_dom($dom);
     }
     return $fileXml;
 }
開發者ID:prashantgajare,項目名稱:civicrm-core,代碼行數:26,代碼來源:XMLRepository.php

示例9: run

 function run()
 {
     // xml document
     $oXML = new DomDocument();
     $oXML->load($this->_sXML);
     $oXML->xinclude();
     // xslt document
     $oXSL = new DomDocument();
     $oXSL->load($this->_sXSLT);
     // xslt processor
     $oProc = new XSLTProcessor();
     $oProc->importStyleSheet($oXSL);
     // set all the parameters
     if (!is_null($this->_aParms)) {
         foreach ($this->_aParms as $k => $v) {
             $oProc->setParameter("", $k, $v);
         }
     }
     // make the transformation
     $sRst = $oProc->transformToXML($oXML);
     unset($oProc);
     unset($oXSL);
     unset($oXML);
     // if output is not null, save the result there
     if (!is_null($this->_sOutput)) {
         $fHand = @fopen($this->_sOutput, "w");
         @fputs($fHand, $sRst);
         @fclose($fHand);
     }
     return $sRst;
 }
開發者ID:redshirtjim,項目名稱:khlogic,代碼行數:31,代碼來源:PHPReportsUtil.php

示例10: process

 /**
  * Try to process the Xinclude transformation
  *
  * @param   string  XML to process.
  *
  * @throws BuildException   On errors
  */
 protected function process($xml)
 {
     if ($this->basedir) {
         $cwd = getcwd();
         chdir($this->basedir);
     }
     $xmlDom = new DomDocument();
     $xmlDom->loadXML($xml);
     $xmlDom->xinclude();
     if ($this->basedir) {
         chdir($cwd);
     }
     return $xmlDom->saveXML();
 }
開發者ID:nmicht,項目名稱:tlalokes-in-acst,代碼行數:21,代碼來源:XincludeFilter.php

示例11: loopElements

<?php

function loopElements($nodes)
{
    $count = 0;
    foreach ($nodes as $node) {
        if ($node instanceof DOMElement) {
            $count++;
            if ($node->childNodes->length > 0) {
                $count += loopElements($node->childNodes);
            }
        }
    }
    return $count;
}
$xml = <<<DOC
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xi="http://www.w3.org/2001/XInclude">
    <a>
        <a_child1>ac1</a_child1>
        <a_child2>ac2</a_child2>
    </a>
    <b><xi:include xpointer="xpointer(/root/a)" /></b>
    <c><xi:include xpointer="xpointer(/root/b)" /></c>
</root>
DOC;
$doc = new DomDocument();
$doc->loadXml($xml);
$doc->xinclude();
$count = loopElements(array($doc->documentElement));
var_dump($count);
開發者ID:badlamer,項目名稱:hhvm,代碼行數:31,代碼來源:bug43364.php


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