当前位置: 首页>>代码示例>>PHP>>正文


PHP fDOMDocument::load方法代码示例

本文整理汇总了PHP中TheSeer\fDOM\fDOMDocument::load方法的典型用法代码示例。如果您正苦于以下问题:PHP fDOMDocument::load方法的具体用法?PHP fDOMDocument::load怎么用?PHP fDOMDocument::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TheSeer\fDOM\fDOMDocument的用法示例。


在下文中一共展示了fDOMDocument::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 private function init($cfgName)
 {
     $this->version = new Version('0.0');
     $this->fileInfo = new FileInfo($this->baseDir . $cfgName . '.xml');
     $this->cfgDom = new fDOMDocument();
     $this->cfgDom->load($this->fileInfo->getPathname());
     $this->cfgDom->registerNamespace('cfg', 'http://xml.phpdox.net/config');
     $this->config = new GlobalConfig($this->version, new FileInfo('/tmp'), $this->cfgDom, $this->fileInfo);
 }
开发者ID:mostwanted1976,项目名称:phpdox,代码行数:9,代码来源:GlobalConfigTest.php

示例2: loadXML

 private function loadXML($fname)
 {
     try {
         if (!file_exists($fname)) {
             throw new EnricherException(sprintf('PHPLoc xml file "%s" not found.', $fname), EnricherException::LoadError);
         }
         $this->dom = new fDOMDocument();
         $this->dom->load($fname);
     } catch (fDOMException $e) {
         throw new EnricherException('Parsing PHPLoc xml file failed: ' . $e->getMessage(), EnricherException::LoadError);
     }
 }
开发者ID:sakshika,项目名称:ATM,代码行数:12,代码来源:PHPLoc.php

示例3: getUnitByName

 public function getUnitByName($name)
 {
     $parts = explode('\\', $name);
     $local = array_pop($parts);
     $namespace = join('\\', $parts);
     $indexNode = $this->index->queryOne(sprintf('//phpdox:namespace[@name="%s"]/*[@name="%s"]', $namespace, $local));
     if (!$indexNode) {
         throw new DependencyException(sprintf("Unit '%s' not found", $name), DependencyException::UnitNotFound);
     }
     $dom = new fDOMDocument();
     $dom->load($this->baseDir . '/' . $indexNode->getAttribute('xml'));
     switch ($indexNode->localName) {
         case 'interface':
             $unit = new InterfaceObject();
             $unit->import($dom);
             $this->project->addInterface($unit);
             break;
         case 'trait':
             $unit = new TraitObject();
             $unit->import($dom);
             $this->project->addTrait($unit);
             break;
         case 'class':
             $unit = new ClassObject();
             $unit->import($dom);
             $this->project->addClass($unit);
             break;
         default:
             throw new DependencyException(sprintf("Invalid unit type '%s'", $indexNode->localName), DependencyException::InvalidUnitType);
     }
     return $unit;
 }
开发者ID:mostwanted1976,项目名称:phpdox,代码行数:32,代码来源:Dependency.php

示例4: getCacheDom

 private function getCacheDom()
 {
     if ($this->cacheDom === NULL) {
         $this->cacheDom = new fDOMDocument();
         $cacheFile = $this->config->getLogfilePath();
         if (file_exists($cacheFile)) {
             $this->cacheDom->load($cacheFile);
             $sha1 = $this->cacheDom->documentElement->getAttribute('sha1');
             $cwd = getcwd();
             chdir($this->config->getSourceDirectory());
             exec($this->config->getGitBinary() . ' diff --name-only ' . $sha1, $files, $rc);
             foreach ($files as $file) {
                 $fields = array('path' => dirname($file), 'file' => basename($file));
                 $query = $this->cacheDom->prepareQuery('//*[@path = :path and @file = :file]', $fields);
                 $node = $this->cacheDom->queryOne($query);
                 if (!$node) {
                     continue;
                 }
                 $node->parentNode->removeChild($node);
             }
             chdir($cwd);
         } else {
             $this->cacheDom->loadXML('<?xml version="1.0" ?><gitlog xmlns="' . self::GITNS . '" />');
             $this->cacheDom->documentElement->setAttribute('sha1', $this->commitSha1);
         }
     }
     return $this->cacheDom;
 }
开发者ID:beingsane,项目名称:phpdox,代码行数:28,代码来源:Git.php

示例5: getUnitByName

 public function getUnitByName($name)
 {
     $parts = explode('\\', $name);
     $local = array_pop($parts);
     $namespace = join('\\', $parts);
     $indexNode = $this->index->queryOne(sprintf('//phpdox:namespace[@name="%s"]/*[@name="%s"]', $namespace, $local));
     if (!$indexNode) {
         return;
     }
     $dom = new fDOMDocument();
     $dom->load($this->baseDir . '/' . $indexNode->getAttribute('xml'));
     switch ($indexNode->localName) {
         case 'interface':
             $unit = new InterfaceObject();
             $unit->import($dom);
             $this->project->addInterface($unit);
             break;
         case 'trait':
             $unit = new TraitObject();
             $unit->import($dom);
             $this->project->addTrait($unit);
             break;
         case 'class':
             $unit = new ClassObject();
             $unit->import($dom);
             $this->project->addClass($unit);
             break;
     }
     return $unit;
 }
开发者ID:sakshika,项目名称:ATM,代码行数:30,代码来源:Dependency.php

示例6: initCollections

 /**
  * @return void
  */
 private function initCollections()
 {
     $this->source = new fDOMDocument();
     $this->source->load($this->xmlDir . '/source.xml');
     $this->source->registerNamespace('phpdox', 'http://xml.phpdox.net/src');
     $this->index = new fDOMDocument();
     $this->index->load($this->xmlDir . '/index.xml');
     $this->index->registerNamespace('phpdox', 'http://xml.phpdox.net/src');
 }
开发者ID:mostwanted1976,项目名称:phpdox,代码行数:12,代码来源:Project.php

示例7: testCSSSelectorHonorsContextNode

 public function testCSSSelectorHonorsContextNode()
 {
     $this->dom->load(__DIR__ . '/_data/selector.xml');
     $ctx = $this->dom->getElementsByTagName('child')->item(0);
     $result = $this->dom->select('child', $ctx);
     $this->assertEquals(1, $result->length);
     $this->assertEquals('child', $result->item(0)->nodeName);
     $this->assertEquals('other', $result->item(0)->getAttribute('attr'));
 }
开发者ID:klikar3,项目名称:yii2-RGraph,代码行数:9,代码来源:fDOMDocument.test.php

示例8: loadDocument

 protected function loadDocument($dir)
 {
     $path = $dir . '/' . $this->getNode()->getAttribute('xml');
     if (!isset($this->dom[$path])) {
         $classDom = new fDOMDocument();
         $classDom->load($path);
         $classDom->registerNamespace('phpdox', 'http://xml.phpdox.net/src');
         $this->dom[$path] = $classDom;
     }
     return $this->dom[$path];
 }
开发者ID:mostwanted1976,项目名称:phpdox,代码行数:11,代码来源:AbstractEntry.php

示例9: load

 /**
  * @param string $filename
  *
  * @return Configuration
  */
 public function load($filename)
 {
     $document = new fDOMDocument();
     $document->load($filename);
     $configuration = new Configuration($document->getElementsByTagName('directory')->item(0)->textContent, $document->getElementsByTagName('domain')->item(0)->textContent, $document->getElementsByTagName('email')->item(0)->textContent);
     if ($document->getElementsByTagName('nginx')->item(0)) {
         $configuration->setNginxConfigurationFile($document->getElementsByTagName('nginx')->item(0)->textContent);
     }
     foreach ($document->getElementsByTagName('series') as $series) {
         /* @var fDOMElement $series */
         $configuration->addAdditionalReleaseSeries($series->getAttribute('package'), $series->getAttribute('series'), $series->getAttribute('alias'));
     }
     return $configuration;
 }
开发者ID:matheusgomes17,项目名称:phar-site-generator,代码行数:19,代码来源:ConfigurationLoader.php

示例10: testParse

 /**
  * @ covers TheSeer\phpDox\DocBlock\Parser::__construct
  * @ covers TheSeer\phpDox\DocBlock\Parser::parse
  *
  * @dataProvider docblockSources
  */
 public function testParse($src)
 {
     $expected = new fDOMDocument();
     $dir = __DIR__ . '/../../data/docbock/';
     $block = file_get_contents($dir . $src);
     $expected->load($dir . $src . '.xml');
     $factory = new Factory();
     $parser = new Parser($factory);
     $result = $parser->parse($block, array());
     $this->assertInstanceOf('TheSeer\\phpDox\\DocBlock\\DocBlock', $result);
     $dom = new fDOMDocument();
     $dom->appendChild($result->asDom($dom));
     $this->assertEquals($expected->documentElement, $dom->documentElement);
 }
开发者ID:gandazgul,项目名称:phpdox,代码行数:20,代码来源:parserTest.php

示例11: loadFindings

 private function loadFindings($xmlFile)
 {
     $this->findings = array();
     try {
         if (!file_exists($xmlFile)) {
             throw new EnricherException(sprintf('Logfile "%s" not found.', $xmlFile), EnricherException::LoadError);
         }
         $dom = new fDOMDocument();
         $dom->load($xmlFile);
         foreach ($dom->query('/checkstyle/file') as $file) {
             $this->findings[$file->getAttribute('name')] = $file->query('*');
         }
     } catch (fDOMException $e) {
         throw new EnricherException('Parsing checkstyle logfile failed: ' . $e->getMessage(), EnricherException::LoadError);
     }
 }
开发者ID:webkingashu,项目名称:phpdox,代码行数:16,代码来源:CheckStyle.php

示例12: collect

 /**
  * @param string[] $units
  * @param string[] $visibilities
  * @return Project
  */
 public function collect(array $units, array $visibilities)
 {
     $this->factory = $this->factory ?: $this->createPhpDoxFactory();
     // set up build directory
     if (!is_dir($this->buildDirectory)) {
         mkdir($this->buildDirectory, 0755, true);
     }
     // create phpdox.xml config file
     $configFile = $this->buildDirectory . '/phpdox.xml';
     $config = $this->createPhpDoxConfig($units, $visibilities);
     file_put_contents($configFile, $config->saveXML());
     // do collect
     $this->runPhpDoxCollector($configFile);
     $phpDoxIndex = new fDOMDocument();
     $phpDoxIndex->load($this->buildDirectory . '/index.xml');
     return new Project($phpDoxIndex, $this->buildDirectory);
 }
开发者ID:renanbr,项目名称:phpact,代码行数:22,代码来源:MetadataCollector.php

示例13: createInstanceFor

 protected function createInstanceFor($fname)
 {
     try {
         $dom = new fDOMDocument();
         $dom->load($fname);
         $root = $dom->documentElement;
         if ($root->namespaceURI == 'http://phpdox.de/config') {
             throw new ConfigLoaderException("File '{$fname}' uses an outdated xml namespace. Please update the xmlns to 'http://phpdox.net/config'", ConfigLoaderException::OldNamespace);
         }
         if ($root->namespaceURI != 'http://phpdox.net/config' || $root->localName != 'phpdox') {
             throw new ConfigLoaderException("File '{$fname}' is not a valid phpDox configuration.", ConfigLoaderException::WrongType);
         }
         $dom->registerNamespace('cfg', 'http://phpdox.net/config');
         return new GlobalConfig($dom, new FileInfo($fname));
     } catch (fDOMException $e) {
         throw new ConfigLoaderException("Parsing config file '{$fname}' failed.", ConfigLoaderException::ParseError, $e);
     }
 }
开发者ID:sakshika,项目名称:ATM,代码行数:18,代码来源:ConfigLoader.php

示例14: testQueryOneReturnsElement

 /**
  * @covers \TheSeer\fDOM\fDOMDocument::queryOne
  */
 public function testQueryOneReturnsElement()
 {
     $this->dom->load(__DIR__ . '/_data/valid.xml');
     $node = $this->dom->queryOne('/test');
     $this->assertInstanceOf('TheSeer\\fDOM\\fDOMElement', $node);
 }
开发者ID:KingNoosh,项目名称:Teknik,代码行数:9,代码来源:fDOMDocument.test.php

示例15: setupDependencies

 private function setupDependencies()
 {
     $this->dependencyStack = array($this->project);
     foreach ($this->config->getDependencyDirectories() as $depDir) {
         $idxName = $depDir . '/index.xml';
         if (!file_exists($idxName)) {
             $this->logger->log("'{$idxName}' not found - skipping dependency");
             continue;
         }
         $dom = new fDOMDocument();
         $dom->load($idxName);
         $this->dependencyStack[] = new Dependency($dom, $this->project);
     }
 }
开发者ID:beingsane,项目名称:phpdox,代码行数:14,代码来源:InheritanceResolver.php


注:本文中的TheSeer\fDOM\fDOMDocument::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。