Put this python file in your path to get the following:
#!/usr/bin/env python
"""
Command-line tool to validate and pretty-print XML.
Based on `pjson` but without the crap.
Usage::
$ echo '<bunk atr="hello">world</bunk>' | pxml
<?xml version="1.0" ?>
<bunk atr="hello">
world
</bunk>
Original Author: Igor Guerrero <igfgt1@gmail.com>, 2012
Contributor: Matthew Gill, 2012
"""importxml.dom.minidomimportsysfrompygmentsimporthighlightfrompygments.formattersimportTerminalFormatterfrompygments.lexersimportXmlLexerdefformat_xml_code(code):"""
Parses XML and formats it
"""x=xml.dom.minidom.parseString(code)returnx.toprettyxml()defcolor_yo_shit(code):"""
Calls pygments.highlight to color yo shit
"""returnhighlight(code,XmlLexer(),TerminalFormatter())if__name__=='__main__':code=format_xml_code(sys.stdin.read())printcolor_yo_shit(code)