遍历流程文件的元素
// 从classpath中获取
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("chapter6/dynamic-form/leave.bpmn");
// 创建转换对象
BpmnXMLConverter converter = new BpmnXMLConverter();
// 创建XMLStreamReader读取XML资源
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader reader = factory.createXMLStreamReader(inputStream);
// 把XML转换成BpmnModel对象
BpmnModel bpmnModel = converter.convertToBpmnModel(reader);
// 验证BpmnModel对象不为空
assertNotNull(bpmnModel);
Process process = bpmnModel.getMainProcess();
Collection<FlowElement> flowElements = process.getFlowElements();
for (FlowElement flowElement : flowElements) {
System.out.println(flowElement);
}