How can I highlight XML on the command line?
Supercat and grcat (grc) can do piped syntax highlighting. You'll probably have to make or find configuration files for XML. They are both available in the Ubuntu repositories as well as at the links provided.
Pygmentize has XML highlighting included. It's available as "python-pygments" in the Ubuntu repositories or by using easy_install Pygments
.
xmllint --format xmlfile.xml | pygmentize -l xml | less
This is how you do it using GNU source-highlight and less:
source-highlight -i /tmp/foo.xml -f esc | less -r
I found highlight in Homebrew for OSX, and I'm sure it's available in the Ubuntu repository. It does highlighting and output to a number of formats, including terminal output.