updated emane model xml to leverage lxml

This commit is contained in:
Blake J. Harnden 2018-07-03 12:48:54 -07:00
parent 4ccb1ed9f3
commit ae94c78fbb
4 changed files with 166 additions and 88 deletions

View file

@ -12,6 +12,12 @@ from core.misc.ipaddress import MacAddress
from core.netns import nodes
def write_xml_file(xml_element, file_path, doctype=None):
xml_data = etree.tostring(xml_element, xml_declaration=True, pretty_print=True, encoding="UTF-8", doctype=doctype)
with open(file_path, "w") as xml_file:
xml_file.write(xml_data)
def get_type(element, name, _type):
value = element.get(name)
if value is not None: