Use an XML parser like XMLStarlet:
$ xmlstarlet sel -t -v '//host' -v '//name' file.xml
This would extract the contents of any <host> or <name> node anywhere in the file.xml XML document.
XMLStarlet is likely available through your ordinary package manager. The executable is sometimes called xmlstarlet rather than just xml.