Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bpmn-io/bpmn-moddle
Read and write BPMN 2.0 XML from JavaScript.
https://github.com/bpmn-io/bpmn-moddle
bpmn javascript moddle xml
Last synced: 3 months ago
JSON representation
Read and write BPMN 2.0 XML from JavaScript.
- Host: GitHub
- URL: https://github.com/bpmn-io/bpmn-moddle
- Owner: bpmn-io
- License: mit
- Created: 2014-04-03T16:46:38.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2024-10-22T01:12:54.000Z (3 months ago)
- Last Synced: 2024-10-29T20:25:25.072Z (3 months ago)
- Topics: bpmn, javascript, moddle, xml
- Language: JavaScript
- Homepage:
- Size: 1.01 MB
- Stars: 446
- Watchers: 28
- Forks: 162
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-bpmn-io - bpmn-moddle - Read, modify and write BPMN 2.0 diagrams from JavaScript (Libraries)
README
# bpmn-moddle
[![CI](https://github.com/bpmn-io/bpmn-moddle/workflows/CI/badge.svg)](https://github.com/bpmn-io/bpmn-moddle/actions?query=workflow%3ACI)
Read and write BPMN 2.0 diagram files in NodeJS and the browser.
__bpmn-moddle__ uses the [BPMN 2.0 meta-model](http://www.omg.org/spec/BPMN/2.0/) to validate the input and produce correct BPMN 2.0 XML.
## Usage
Get the library via [npm package](https://www.npmjs.org/package/bpmn-moddle). Consume it in NodeJS, via UMD or bundle it using your favorite build tool.
```javascript
import BpmnModdle from 'bpmn-moddle';const moddle = new BpmnModdle();
const xmlStr =
'' +
'' +
'';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
} = await moddle.toXML(definitions);
```## Resources
* [Issues](https://github.com/bpmn-io/bpmn-moddle/issues)
* [Examples](https://github.com/bpmn-io/bpmn-moddle/tree/master/test/spec/xml)
* [Changelog](./CHANGELOG.md)## 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.
```bash
# execute the test
npm test# perform a full build
npm run all
```## Related
The library is built on top of [moddle](https://github.com/bpmn-io/moddle) and [moddle-xml](https://github.com/bpmn-io/moddle-xml).
## License
Use under the terms of the [MIT license](http://opensource.org/licenses/MIT).