A moddle wrapper for DMN 1.3
npm install dmn-moddle
Read and write DMN 1.3 files in NodeJS and the browser.
__dmn-moddle__ uses the DMN specification to validate the input and produce correct DMN XML. The library is built on top of moddle and moddle-xml.
Get the library via npm package. Consume it in NodeJS or bundle it using your favorite build tool.
``javascript
import { DmnModdle } from 'dmn-moddle';
const moddle = new DmnModdle();
const xmlStr =
'' +
'
'namespace="http://camunda.org/schema/1.0/dmn">' +
'
';
const {
rootElement: definitions
} = await moddle.fromXML(xmlStr);
// update id attribute
definitions.set('id', 'NEW ID');
// add a root element
const dmnDecision = moddle.create('dmn:Decision', { id: 'MyDecision' });
definitions.get('drgElement').push(dmnDecision);
// xmlStrUpdated contains new id and the added process
const {
xml: xmlStrUpdated
} = await moddle.toXML(definitions);
`
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 library via
```
npm run all
Use under the terms of the MIT license.