本文整理匯總了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);
}