Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

DOMXPath->evaluate()

(no version information, might be only in CVS)

DOMXPath->evaluate() --  Evaluates the given XPath expression and returns a typed result if possible.

Описание

class DOMXPath {

mixed evaluate ( string expression [, DOMNode contextnode] )

}

Executes the given XPath expression and returns a typed result if possible.

Список параметров

expression

The XPath expression to execute.

contextnode

The optional contextnode can be specified for doing relative XPath queries. By default, the queries are relative to the root element.

Возвращаемые значения

Returns a typed result if possible or a DOMNodeList containing all nodes matching the given XPath expression.

Примеры

Пример 1. Getting the count of all the english books

<?php

$doc
= new DOMDocument;

$doc->load('book.xml');

$xpath = new DOMXPath($doc);

$tbody = $doc->getElementsByTagName('tbody')->item(0);

// our query is relative to the tbody node
$query = 'count(row/entry[. = "en"])';

$entries = $xpath->evaluate($query, $tbody);
echo
"There are $entries english books\n";

?>

Результат выполнения данного примера:

There are 2 english books

Смотрите также

DOMXPath->query()



add a note add a note User Contributed Notes
DOMXPath->evaluate()
yuriucsal at NOSPAM dot yahoo dot com dot br
06-Mar-2005 12:55
this class can substitute the method evaluate while it is not validated. Made for Yuri Bastos and Jo
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571