Examples (6)
Return all nodes (tags) named "foo"
xmllint --xpath "//foo" source_file.xmlReturn the contents of the first node named "foo" as a string
xmllint --xpath "string(//foo)" source_file.xmlReturn the href attribute of the second anchor element in an HTML file
xmllint --html --xpath "string(//a[2]/@href)" webpage.xhtmlReturn human-readable (indented) XML from file
xmllint --format source_file.xmlCheck that an XML file meets the requirements of its DOCTYPE declaration
xmllint --valid source_file.xmlValidate XML against DTD schema hosted online
xmllint --dtdvalid URL source_file.xmlmade by @shridhargupta | data from tldr-pages