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); } } }
public function __construct(Document $doc) { parent::__construct($doc); $this->doc = $doc; if ($doc->prefix) { $doc->xPath->registerNamespace('x', $doc->lookupNamespaceUri($doc->prefix)); } $this->readyToCache(); }
/** * 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 }
/** * 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); } } }
/** * @param \DOMDocument $doc */ public function __construct(\DOMDocument $doc) { parent::__construct($doc); $this->doc = $doc; }
public function __construct(\DOMDocument $dom, $ns = array()) { $this->dom = $dom; parent::__construct($dom); $this->registerNamespaces($ns); }
/** * DomXpath constructor. * @param DocumentWrapper $doc */ public function __construct(DocumentWrapper $doc) { $this->documentWrapper = $doc; parent::__construct($doc->getDom()); }