GithubHelp home page GithubHelp logo

hhy5277 / bpmn-moddle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bpmn-io/bpmn-moddle

0.0 1.0 0.0 1.14 MB

Read and write BPMN 2.0 XML from JavaScript.

License: MIT License

JavaScript 100.00%

bpmn-moddle's Introduction

bpmn-moddle

CI

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

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
} = await moddle.toXML(definitions);

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.

bpmn-moddle's People

Contributors

barmac avatar falko avatar felixlinker avatar hawky-4s- avatar iso50 avatar nikku avatar oguzeroglu avatar pedesen avatar philippfromme avatar sebastianstamm avatar wkit23 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.