@SneakyThrows
public void add(FlowModelAdd param, MultipartFile file){ byte[] bytes = file.getBytes(); String xml = new String(bytes, StandardCharsets.UTF_8); //创建转换对象 BpmnXMLConverter converter = new BpmnXMLConverter(); XMLInputFactory factory = XMLInputFactory.newInstance(); // 字节方式 XMLStreamReader reader = factory.createXMLStreamReader(new ByteArrayInputStream(xml.getBytes())); // 流方式 XMLStreamReader reader = factory.createXMLStreamReader(file.getInputStream()); //将xml文件转换成BpmnModel BpmnModel bpmnModel = converter.convertToBpmnModel(reader); System.out.println(bpmnModel); }
来源:
35分类目录