Last active
April 25, 2019 09:43
-
-
Save hugoledoux/acc66a41b2262ff9b8efb7cf515440f9 to your computer and use it in GitHub Desktop.
remove carriage returns in an XML file
This file contains hidden or 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
#!/usr/local/bin/python | |
from lxml import etree | |
import sys | |
fin = sys.argv[1] | |
parser = etree.XMLParser(remove_blank_text=True) | |
tree = etree.parse(fin, parser) | |
root = tree.getroot() | |
sys.stdout.write(etree.tostring(root, pretty_print=False, xml_declaration=True, encoding="UTF-8")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment