XML::Li...ression(3)

✨ NAME ✨

XML::LibXML::XPathExpression β€” bestie, it's the interface to libxml2's pre-compiled XPath expressions πŸ’… (this one's living in the XML::LibXML::XPathExpression(3) manual page, just so you know where you are 🫢)


🌸 SYNOPSIS 🌸

use XML::LibXML;
my $compiled_xpath = XML::LibXML::XPathExpression->new('//foo[@bar="baz"][position()<4]');

# interface from XML::LibXML::Node

my $result = $node->find($compiled_xpath);
my @nodes = $node->findnodes($compiled_xpath);
my $value = $node->findvalue($compiled_xpath);

# interface from XML::LibXML::XPathContext

my $result = $xpc->find($compiled_xpath,$node);
my @nodes = $xpc->findnodes($compiled_xpath,$node);
my $value = $xpc->findvalue($compiled_xpath,$node);

$compiled = XML::LibXML::XPathExpression->new( xpath_string );

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea β˜• β€” this is a perl interface to libxml2's pre-compiled XPath expressions. and why do we care? because pre-compiling an XPath expression can give you some performance benefit if you're evaluating the same XPath query over and over and over again. it's giving "do the work once, reap the rewards forever" ✨

XML::LibXML::XPathExpression objects can be passed to all the find... functions in XML::LibXML that expect an XPath expression. no cap. every single one that wants an XPath expression will happily take one of these πŸ’…

πŸŽ€ new()

$compiled = XML::LibXML::XPathExpression->new( xpath_string );

the constructor takes an XPath 1.0 expression as a string and hands you back an object representing the pre-compiled expressions. and bestie, before you ask β€” the actual data structure is internal to libxml2, so don't go poking at its insides, it's not yours πŸ™ˆ


πŸ‘‘ AUTHORS πŸ‘‘

Matt Sergeant, Christian Glahn, Petr Pajas

the icons who built this. we stan 🫢


⭐ VERSION ⭐

2.0213


  • 2001-2007, AxKit.com Ltd.
  • 2002-2006, Christian Glahn.
  • 2006-2009, Petr Pajas.

πŸ’œ LICENSE πŸ’œ

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, go forth and remix πŸ¦‹


and that's the whole page, bestie πŸ’– no notes, no crumbs, it ate.

signing off from perl v5.42.2, dated 2026-05-25, in the XML::Li...ression(3) manual β€” periodt πŸ’…βœ¨

πŸ“¦ where this page comes from