DOMXPath::__construct

(PHP 5, PHP 7, PHP 8)

DOMXPath::__construct Creates a new DOMXPath object

Description

public DOMXPath::__construct(DOMDocument $document, bool $registerNodeNS = true)

Creates a new DOMXPath object.

Parameters

document

The DOMDocument associated with the DOMXPath.

registerNodeNS

Whether to automatically register the in-scope namespace prefixes of the context node to the DOMXPath object. This can be used to avoid needing to call DOMXPath::registerNamespace() manually for each in-scope namespaces. When a namespace prefix conflict exists, only the nearest descendant namespace prefix is registered.

add a note

User Contributed Notes 1 note

up
19
Saulo Vallory
17 years ago
The DOMXPath object doesn't create a reference to the document. If you load a new xml using either load, loadXML or loadHTML functions the DOMXPath object will still query and evaluate over the source in the DOMDocument when it was created.
To Top