PHP Class FluentDOM\Xpath

Inheritance: extends DOMXPath
Afficher le fichier Open project: fluentdom/fluentdom Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( DOMDocument $dom ) 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.
__get ( string $name ) : mixed
__invoke ( string $expression, DOMNode $contextNode = NULL ) : string | float | boolean | DOMNodeList Fetch nodes or scalar values from the DOM using Xpath expression.
__isset ( string $name ) : boolean
__set ( string $name, mixed $value ) : mixed
__unset ( string $name )
evaluate ( string $expression, DOMNode $contextNode = NULL, null | boolean $registerNodeNS = NULL ) : string | float | boolean | DOMNodeList Fetch nodes or scalar values from the DOM using Xpath expression.
firstOf ( string $expression, DOMNode $contextNode = NULL, null | boolean $registerNodeNS = NULL ) : DOMNode | null Returns the first node matched by the expression or NULL.
query ( string $expression, DOMNode $contextNode = NULL, null | boolean $registerNodeNS = NULL ) : DOMNodeList Fetch nodes defined by the xpath expression and return the node list.
quote ( string $string ) : string Quote (and escape) a value to use it in an xpath expression.
registerNamespace ( string $prefix, string $namespace ) : boolean If the owner document is a FluentDOM\Document register the namespace on the document object, too.

Method Details

__construct() public méthode

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.
public __construct ( DOMDocument $dom )
$dom DOMDocument

__get() public méthode

public __get ( string $name ) : mixed
$name string
Résultat mixed

__invoke() public méthode

Fetch nodes or scalar values from the DOM using Xpath expression.
public __invoke ( string $expression, DOMNode $contextNode = NULL ) : string | float | boolean | DOMNodeList
$expression string
$contextNode DOMNode
Résultat string | float | boolean | DOMNodeList

__isset() public méthode

public __isset ( string $name ) : boolean
$name string
Résultat boolean

__set() public méthode

public __set ( string $name, mixed $value ) : mixed
$name string
$value mixed
Résultat mixed

__unset() public méthode

public __unset ( string $name )
$name string

evaluate() public méthode

The main difference to DOMXpath::evaluate() is the handling of the third argument. Namespace registration can be changed using the property and is disabled by default.
public evaluate ( string $expression, DOMNode $contextNode = NULL, null | boolean $registerNodeNS = NULL ) : string | float | boolean | DOMNodeList
$expression string
$contextNode DOMNode
$registerNodeNS null | boolean
Résultat string | float | boolean | DOMNodeList

firstOf() public méthode

Returns the first node matched by the expression or NULL.
public firstOf ( string $expression, DOMNode $contextNode = NULL, null | boolean $registerNodeNS = NULL ) : DOMNode | null
$expression string
$contextNode DOMNode
$registerNodeNS null | boolean
Résultat DOMNode | null

query() public méthode

This method is deprecated and only implemented for BC. So this method calls evaluate().
Deprecation:
public query ( string $expression, DOMNode $contextNode = NULL, null | boolean $registerNodeNS = NULL ) : DOMNodeList
$expression string
$contextNode DOMNode
$registerNodeNS null | boolean
Résultat DOMNodeList

quote() public méthode

Xpath 1 does not have a way to escape quotes, it only allows double quotes in single quoted literals and single quotes in double quoted literals. If both quotes are included in the string, the method will generate a concat() function call.
public quote ( string $string ) : string
$string string
Résultat string

registerNamespace() public méthode

If the owner document is a FluentDOM\Document register the namespace on the document object, too.
public registerNamespace ( string $prefix, string $namespace ) : boolean
$prefix string
$namespace string
Résultat boolean