Created
December 12, 2022 15:41
-
-
Save dhumanity/1625a4815248e1e079b146cf3d97600a to your computer and use it in GitHub Desktop.
pretty print XML on python3, originally to python2 from https://gist.github.com/rspivak/74a08170a2a04a344161
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias ppxml='python3 -c "import sys, io;from lxml import etree;print(etree.tostring(etree.parse(io.StringIO(sys.stdin.read()),etree.XMLParser(remove_blank_text = True)), pretty_print = True).decode(\"utf-8\"))"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After adding this alias into .bash_profile and re-sourcing it.
Usage is as simple as feeding the alias the stdin
cat notpretty.xml | ppxml