项目
在 GitHub 查看
bpmn-io/bpmn-moddle
关于
使用 JavaScript 读写 BPMN 2.0 XML。
开发工具实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- -1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文bpmn-moddle
Read and write BPMN 2.0 diagram files in NodeJS and the browser.
bpmn-moddle uses the BPMN 2.0 meta-model to validate the input and produce correct BPMN 2.0 XML.
Usage
Get the library via npm package. Consume it in NodeJS or bundle it using your favorite build tool.
import { BpmnModdle } from 'bpmn-moddle';
const moddle = new BpmnModdle();
const xmlStr =
'<?xml version="1.0" encoding="UTF-8"?>' +
'<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" ' +
'id="empty-definitions" ' +
'targetNamespace="http://bpmn.io/schema/bpmn">' +
'</bpmn2:definitions>';
const {
rootElement: definitions
} = await moddle.fromXML(xmlStr);
// update id attribute
definitions.set('id', 'NEW ID');
// add a root element
const bpmnProcess = moddle.create('bpmn:Process', { id: 'MyProcess_1' });
definitions.get('rootElements').push(bpmnProcess);
// xmlStrUpdated contains new id and the added process
const {
xml: xmlStrUpdated,
warnings
} = await moddle.toXML(definitions);
// warnings lists what could not be exported, e.g. attributes with an unknown namespace prefix
Resources
Building the Project
The tests include XSD schema validation. They required you to have a Java SDK installed and exposed through the JAVA_HOME variable.
# execute the test
npm test
# perform a full build
npm run all
Related
The library is built on top of moddle and moddle-xml.
License
Use under the terms of the MIT license.
探索相关项目
加载中…