Created
September 25, 2021 01:40
-
-
Save swhume/0c5d6b945ce5ad213be75b54ce83f970 to your computer and use it in GitHub Desktop.
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
import sys | |
import xml.etree.ElementTree as ET | |
""" Simple program snippet to demonstrate parsing the CXL XML CMAP export format """ | |
ET.register_namespace('', "http://cmap.ihmc.us/xml/cmap/") | |
# get the CXL file to parse from the command-line | |
if len(sys.argv) > 1: | |
cxl_file = sys.argv[1] | |
else: | |
print("Please include the CXL filename with path on the command-line.") | |
sys.exit() | |
# parse the file and get the root element | |
tree = ET.parse(cxl_file) | |
root = tree.getroot() | |
# print the elements in the CXL file with their attributes | |
for elem in root.iter(): | |
print(f"{elem.tag.split('}')[1]}: {elem.attrib}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment