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