XPATH(1p)

πŸ¦‹ XPATH β€” the manual page, bestie edition ✨

okay so real quick: this whole thing lives in the manual as XPATH(1p), filed under User Contributed Perl Documentation. It's the xpath script, and I'm about to make you obsessed with it. no cap. πŸ’…


🌸 NAME 🌸

xpath β€” a script to query XPath statements in XML documents. that's it. that's the whole vibe. πŸŽ€


✨ SYNOPSIS ✨

xpath [-s suffix] [-p prefix] [-n] [-q] -e query [-e query] ... [file]
...

πŸ’– DESCRIPTION πŸ’–

so xpath uses the XML::XPath perl module to make XPath queries to any XML document. the XML::XPath module is out here trying to comply exactly to the XPath specification over at http://www.w3.org/TR/xpath, and yet β€” plot twist β€” it still lets extensions get added in the form of functions. iconic behavior honestly. πŸ‘‘

the script takes any number of XPath pointers and tries to apply them to each XML document you hand it on the command line. and if you give it no file arguments? no problem. the query is done using STDIN as an XML document. she's flexible like that. 🫢

now here's the part where you gotta pay attention, bestie:

  • when multiple queries exist, the result of the last query is used as the context for the next query β€” and only the result of the last one is output.
  • the context of the first query is always the root of the current document.

that's the whole pipeline. chain them up, she passes the baton. πŸƒβ™€οΈβœ¨


πŸŽ€ OPTIONS πŸŽ€

-q

be quiet. 🀫 output only errors (and no separator) on stderr.

-n

never use an external DTD, ie. instantiate the XML::Parser module with 'ParseParamEnt => 0'. hard pass on that DTD energy.

-s suffix

place suffix at the end of each entry. default is a linefeed.

-p prefix

place prefix preceding each entry. default is nothing.


πŸ’€ BUGS πŸ’€

the author of this man page is not very "fluant" in english (their word, not mine β€” I'm quoting fr fr πŸ™ˆ). please, send him (fabien@tzone.org) any corrections concerning this text. be nice about it. πŸ“


🌈 SEE ALSO 🌈

  • XML::XPath

this module is copyright 2000 AxKit.com Ltd. this is free software, and as such comes with NO WARRANTY. no dates are used in this module. you may distribute this module under the terms of either the Gnu GPL, or the Artistic License (the same terms as Perl itself). ✨

for support, please subscribe to the Perl-XML mailing list at the URL http://listserv.activestate.com/mailman/listinfo/perl-xml


lowkey important: NO WARRANTY, bestie. she's free software and she's free of promises. respect the license. 🫢

and that's a wrap on the xpath page, written for perl v5.40.1 and dated 2026-04-05. go query something. slay. πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from