XML parser and linter that supports XPath, a syntax for navigating XML trees. More information: https://manned.org/xmllint.
xmllint --xpath "//foo" source_file.xml
xmllint --xpath "string(//foo)" source_file.xml
xmllint --html --xpath "string(//a[2]/@href)" webpage.xhtml
xmllint --format source_file.xml
xmllint --valid source_file.xml
xmllint --dtdvalid URL source_file.xml