The following works when run against your test data:
{ read -r host; read -r username; read -r password; read -r dbname; } \
< <(xmlstarlet sel -t -m /config/global/resources/default_setup/connection \
-v ./host -n \
-v ./username -n \
-v ./password -n \
-v ./dbname -n)
This puts the content into variables host
, username
, password
and dbname
.