xmlq
is a tool to query a XML document using XPath. It is written in Go and uses github.com/antchfx/xmlquery to parse the XML and query it using XPath.
For information on XPath support, see the documentation of the underlying github.com/antchfx/xpath lib.
$ go install github.com/gkawamoto/xmlq@main
$ xmlq -h
Usage of xmlq:
-p pretty print
-t inner text
$ echo "<payload><key>value</key></payload>" | xmlq -t '/payload/key'
value
$ echo "<payload><key>value</key></payload>" | xmlq -p
<?xml version="1.0"?>
<payload>
<key>value</key>
</payload>
Push your changes to a branch and open a pull request.