Implement '--xpath' argument for 'virsh dumpxml'

Goal

Provide an in-built mechanism to extract information from the XML blob generated by virsh dumpxml, ideally using XPath rather than a homegrown syntax.

Technical details

virsh dumpxml provides a complete picture of the state of an instance. Sometimes a user will want to retrieve specific information from this blob to answer questions like "give me the MAC address for this interface". Currently, this requires the use of external tooling such as xmllint. For example:

$ virsh dumpxml 14 | xmllint --xpath '/domain/devices/interface' -

This can be a problem in production environments where these tools might not be available. While cobbling together separate tools would appear to align well with the Unix philosophy at first glance, being able to select part of the output from this command does feel like something that belongs to the command itself.

Additional information

xmllint is provided by libxml, which afaict is what libvirt uses for all things XML. It's likely that we can reuse some/all of the logic from this tool in libvirt, avoiding the need to reinvent the (very complex) wheel.

Edited by Stephen Finucane