本文整理汇总了PHP中TheSeer\fDOM\fDOMDocument::prepareQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP fDOMDocument::prepareQuery方法的具体用法?PHP fDOMDocument::prepareQuery怎么用?PHP fDOMDocument::prepareQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TheSeer\fDOM\fDOMDocument
的用法示例。
在下文中一共展示了fDOMDocument::prepareQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: testPrepareQueryReturnsValidXPathString
public function testPrepareQueryReturnsValidXPathString()
{
$values = array('key' => 'the "value" of \'values\'');
$xpath = '//some[@value = :key]';
$result = $this->dom->prepareQuery($xpath, $values);
$this->assertEquals('//some[@value = concat("the ",\'"\',"value",\'"\'," of \'values\'")]', $result);
}