studio-moddle

0.0.3 • Public • Published

bpmn-moddle

Build Status

For Front-end: 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, via UMD or bundle it for the browser using your favorite module bundler.

import BpmnModdle from 'bpmn-moddle';

var moddle = new BpmnModdle();

var 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>';


moddle.fromXML(xmlStr, function(err, definitions) {

  // update id attribute
  definitions.set('id', 'NEW ID');

  // add a root element
  var bpmnProcess = moddle.create('bpmn:Process', { id: 'MyProcess_1' });
  definitions.get('rootElements').push(bpmnProcess);

  moddle.toXML(definitions, function(err, xmlStrUpdated) {

    // xmlStrUpdated contains new id and the added process

  });

});

Resources

Building the Project

To run the test suite that includes XSD schema validation you must have a Java JDK installed and properly exposed through the JAVA_HOME variable.

Execute the test via

npm test

Perform a complete build of the application via

npm run all

Related

The library is built on top of moddle and moddle-xml.

License

Use under the terms of the MIT license.

Package Sidebar

Install

npm i studio-moddle

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

1.44 MB

Total Files

140

Last publish

Collaborators

  • jollypk