HTML::O...valuator(3)
okay bestie, you've landed on HTML::O...valuator(3) โ the User Contributed Perl Documentation page for HTML::Object::DOM::XPathEvaluator, aka the HTML Object DOM XPathEvaluator Class. buckle up, it's XPath time. ๐
โจ
๐ NAME ๐
HTML::Object::DOM::XPathEvaluator โ the HTML Object DOM XPathEvaluator Class. that's the name, that's the class, periodt. ๐
๐ SYNOPSIS ๐
use HTML::Object::DOM::XPathEvaluator;
my $this = HTML::Object::DOM::XPathEvaluator->new ||
die( HTML::Object::DOM::XPathEvaluator->error, "\n" );
โญ VERSION โญ
v0.2.0 โ that's the version, bestie. ๐
๐ฆ DESCRIPTION ๐ฆ
The XPathEvaluator interface is here to compile and evaluate XPath expressions. that's literally its whole thing. โจ
๐ธ PROPERTIES ๐ธ
There are no properties. none. zero. the void. ๐
๐ ๏ธ METHODS ๐ ๏ธ
okay, method time. here's the roster:
๐ซ createExpression ๐ซ
This one creates a parsed XPath expression with resolved namespaces. slay. ๐
Example:
<div>XPath example</div>
<div>Number of <div>s: <output></output></div>
use HTML::Object::DOM;
my $parser = HTML::Object::DOM->new;
my $doc = $parser->parse_data( $html ) || die( $parser->error );
my $evaluator = HTML::Object::DOM::XPathEvaluator->new;
my $expression = $evaluator->createExpression( '//div' );
my $result = $expression->evaluate( $document );
$doc->querySelector( 'output' )->textContent = $result->snapshotLength;
See also Mozilla documentation at https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/createExpression.
๐ฎ createNSResolver ๐ฎ
This always returns undef, since this HTML::Object does not work on XML documents. like, always always. ๐
Normally, this would adapt any DOM node to resolve namespaces allowing the XPath expression to be evaluated relative to the context of the node where it appeared within the document.
See also Mozilla documentation at https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/createNSResolver.
๐ evaluate ๐
Evaluates an XPath expression string and returns a result of the specified type if possible. iconic. โจ
Parameters:
expressionโ A string representing the XPath expression to be parsed and evaluated, or an XPath expression object to be evaluated. The latter would be equivalent to:
$xpath_expression->evaluate( $context );
With $context being a node object provided, such as HTML::Object::DOM::Document.
contextNodeโ A Node representing the context to use for evaluating the expression.
Example:
<div>XPath example</div>
<div>Number of <div>s: <output></output></div>
use HTML::Object::DOM;
my $parser = HTML::Object::DOM->new;
my $doc = $parser->parse_data( $html ) || die( $parser->error );
my $evaluator = HTML::Object::DOM::XPathEvaluator->new;
my $result = $evaluator->evaluate( '//div', $doc );
$doc->querySelector( 'output' )->textContent = $result->snapshotLength;
See also Mozilla documentation at https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/evaluate.
๐ AUTHOR ๐
Jacques Deguest <jack@deguest.jp> โ the author, the legend. ๐
๐ฆ SEE ALSO ๐ฆ
HTML::Selector::XPath, HTML::Object::XPath, HTML::Object::XPath::Expr โ go read those next, bestie. ๐ฅ
๐ COPYRIGHT & LICENSE ๐
Copyright(c) 2022 DEGUEST Pte. Ltd.
All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay that's the whole page. footer check: perl v5.42.2, dated 2026-02-15, and the page name is HTML::O...valuator(3). mwah ๐๐ซถ
๐ฆ where this page comes from
- alpine 3.24: perl-html-object-doc 0.6.0-r1 ยท GPL-1.0-or-later OR Artistic-1.0-Perl
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms