php / 8.1.5 / class.domxpath.html /

The DOMXPath class

Introduction

(PHP 5, PHP 7, PHP 8)

Supports XPath 1.0

Class synopsis

class DOMXPath {
/* Properties */
public readonly DOMDocument $document;
/* Methods */
public __construct( DOMDocument $document, bool $registerNodeNS = true)
public evaluate(string $expression, ?DOMNode $contextNode = null, bool $registerNodeNS = true): mixed
public query(string $expression, ?DOMNode $contextNode = null, bool $registerNodeNS = true): mixed
public registerNamespace(string $prefix, string $namespace): bool
public registerPhpFunctions(string|array|null $restrict = null): void
}

Properties

document
registerNodeNamespaces

When set to true, namespaces in the node are registered.

Changelog

Version Description
8.0.0 The registerNodeNamespaces property has been added.

Table of Contents

© 1997–2021 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.domxpath.php