| Conditions | 4 |
| Total Lines | 13 |
| Code Lines | 11 |
| Lines | 13 |
| Ratio | 100 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 38 | View Code Duplication | def create_xml_tree(xml_doc): |
|
|
|
|||
| 39 | try: |
||
| 40 | xml_tree = etree.parse(xml_doc) |
||
| 41 | xml_tree = xml_tree.getroot() |
||
| 42 | except IOError as err: |
||
| 43 | error_and_exit("Failed to read xml_file: {} (exit)".format(str(err))) |
||
| 44 | except etree.Error as err: |
||
| 45 | error_and_exit("Failed to parse xml_file: {} (exit)".format(str(err))) |
||
| 46 | |||
| 47 | if len(xml_tree) == 0: |
||
| 48 | error_and_exit("XML file is empty (exit)") |
||
| 49 | |||
| 50 | return xml_tree |
||
| 51 |