I have an xml file
localhost
You have two faults:
/preferences/options/dbUser
xmlstarlet edit --update '/preferences/options/dbUser' --value 123 preferences.xml > preferences.xml
or you can use global option --inplace
which replaces the input file with the output (instead of printing it to stdin). The command is xmlstarlet edit --inplace --update '/preferences/options/dbUser' --value 123 preferences.xml
Type xmlstarlet edit --help
for more info