本文整理匯總了PHP中TheSeer\fDOM\fDOMDocument::getElementsByTagName方法的典型用法代碼示例。如果您正苦於以下問題:PHP fDOMDocument::getElementsByTagName方法的具體用法?PHP fDOMDocument::getElementsByTagName怎麽用?PHP fDOMDocument::getElementsByTagName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TheSeer\fDOM\fDOMDocument
的用法示例。
在下文中一共展示了fDOMDocument::getElementsByTagName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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'));
}
示例2: 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;
}
示例3: getMethods
/**
* @return MethodCollection
*/
public function getMethods()
{
$list = $this->document->getElementsByTagName('method');
return new MethodCollection($list, $this);
}