Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Pretty print XML with lxml

View ppxml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/env python
import sys
import StringIO
from lxml import etree
def main():
xml_text = sys.stdin.read()
parser = etree.XMLParser(remove_blank_text=True)
file_obj = StringIO.StringIO(xml_text)
tree = etree.parse(file_obj, parser)
print(etree.tostring(tree, pretty_print=True))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.