Handles processes with multiple top-level elements

This commit is contained in:
Aaron Louie 2020-02-10 15:20:45 -05:00
parent b63ad7f707
commit fd9c685979
1 changed files with 10 additions and 1 deletions

View File

@ -161,7 +161,16 @@ class WorkflowProcessor(object):
if len(process_elements) == 0:
raise Exception('No executable process tag found')
# There are multiple root elements
if len(process_elements) > 1:
raise Exception('Multiple executable processes tags found')
# Look for the element that has the startEvent in it
for e in process_elements:
this_element: ElementTree.Element = e
for child_element in list(this_element):
if child_element.tag.endswith('startEvent'):
return this_element.attrib['id']
raise Exception('No start event found in %s' % et_root.attrib['id'])
return process_elements[0].attrib['id']