Read the pattern from example.xml (which will also check if the element containing "ood" is there, and fail otherwise)

xidel

  • Download and extract data from HTML/XML pages as well as JSON APIs.
    More information: <https://www.videlibri.de/xidel.html>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

xidel {{path/to/example.xml}} --extract "{{<x><foo>ood</foo><bar>{.}</bar></x>}}"

click the source code to copy install xidel on any operating system with command-not-found.com