Vim lets you set equalprg option for each filetype. From Vim docs:
External program to use for "=" command. When this option is empty the internal formatting functions are used; either 'lisp', 'cindent' or 'indentexpr'. When Vim was compiled without internal formatting, the "indent" program is used. ...
xmllint command (on Unix-like systems it comes with libxml
package). Then add following line to you .vimrc:
au FileType xml setlocal equalprg=xmllint\ --format\ --recover\ -\ 2>/dev/null
Now, to pretty format your XML just type