本文整理汇总了PHP中DOMXPath::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMXPath::__construct方法的具体用法?PHP DOMXPath::__construct怎么用?PHP DOMXPath::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMXPath
的用法示例。
在下文中一共展示了DOMXPath::__construct方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(DOMDocument $doc)
{
parent::__construct($doc);
if (is_a($doc->documentElement, 'EPubDOMElement')) {
foreach ($doc->documentElement->namespaces as $ns => $url) {
$this->registerNamespace($ns, $url);
}
}
}
示例2: __construct
public function __construct(Document $doc)
{
parent::__construct($doc);
$this->doc = $doc;
if ($doc->prefix) {
$doc->xPath->registerNamespace('x', $doc->lookupNamespaceUri($doc->prefix));
}
$this->readyToCache();
}
示例3: __construct
/**
* HHVM and some old PHP versions do not have a $document property by default
* Add it is added if it was not found after executing parent constructor.
*
* @param \DOMDocument $dom
*/
public function __construct(\DOMDocument $dom)
{
parent::__construct($dom);
// store the document reference to avoid optimization to DOMDocument
$this->_documentReference = $dom;
// @codeCoverageIgnoreStart
if (!isset($this->document)) {
$this->document = $dom;
}
// @codeCoverageIgnoreEnd
}
示例4: __construct
/**
* Make instance of DOMXPath and register namespaces if required
*
* @param DOMDocument $doc DOMDocument to run DOMXPath over
*
* @return void
*
* @untranslatable null
* @untranslatable namespace::*
*/
public function __construct($doc)
{
parent::__construct($doc);
$rootNamespace = $doc->lookupNamespaceUri($doc->namespaceURI);
if ($rootNamespace !== null) {
$prefix = $doc->lookupPrefix($doc->namespaceURI);
$prefix = $prefix === null ? "null" : $prefix;
$this->registerNamespace($prefix, $rootNamespace);
}
foreach ($this->query("namespace::*") as $node) {
$prefix = $doc->lookupPrefix($node->nodeValue);
if ($prefix !== null) {
$this->registerNamespace($prefix, $node->nodeValue);
}
}
}
示例5: __construct
/**
* @param \DOMDocument $doc
*/
public function __construct(\DOMDocument $doc)
{
parent::__construct($doc);
$this->doc = $doc;
}
示例6: __construct
public function __construct(\DOMDocument $dom, $ns = array())
{
$this->dom = $dom;
parent::__construct($dom);
$this->registerNamespaces($ns);
}
示例7: __construct
/**
* DomXpath constructor.
* @param DocumentWrapper $doc
*/
public function __construct(DocumentWrapper $doc)
{
$this->documentWrapper = $doc;
parent::__construct($doc->getDom());
}