Skip to content

Instantly share code, notes, and snippets.

@savage69kr
Forked from rspivak/ppxml
Created May 12, 2014 13:35
Show Gist options
  • Save savage69kr/c90a75f3472fe2e0aacf to your computer and use it in GitHub Desktop.
Save savage69kr/c90a75f3472fe2e0aacf to your computer and use it in GitHub Desktop.
#!/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