Read and write XML documents described with moddle.
Installations
npm install moddle-xml
Developer Guide
Typescript
No
Module System
ESM
Min. Node Version
>= 18
Node Version
20.11.1
NPM Version
10.2.4
Score
92.6
Supply Chain
99.6
Quality
83.9
Maintenance
100
Vulnerability
100
License
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
bpmn-io
Download Statistics
Total Downloads
13,162,600
Last Day
1,948
Last Week
86,644
Last Month
386,984
Last Year
4,180,898
GitHub Statistics
49 Stars
316 Commits
19 Forks
15 Watching
5 Branches
18 Contributors
Package Meta Information
Latest Version
11.0.0
Package Id
moddle-xml@11.0.0
Unpacked Size
366.97 kB
Size
80.06 kB
File Count
8
NPM Version
10.2.4
Node Version
20.11.1
Publised On
06 Mar 2024
Total Downloads
Cumulative downloads
Total Downloads
13,162,600
Last day
-14.3%
1,948
Compared to previous day
Last week
-5.4%
86,644
Compared to previous week
Last month
-5.8%
386,984
Compared to previous month
Last year
31.5%
4,180,898
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
Dev Dependencies
7
moddle-xml
Read and write XML documents described with moddle.
Usage
Get the libray via npm
npm install --save moddle-xml
Bootstrap
Create a moddle instance
1import { Moddle } from 'moddle'; 2import { 3 Reader, 4 Writer 5} from 'moddle-xml'; 6 7const model = new Moddle([ myPackage ]);
Read XML
Use the reader to parse XML into an easily accessible object tree:
1const model; // previously created 2 3const xml = 4 '<my:root xmlns:props="http://mypackage">' + 5 '<my:car id="Car_1">' + 6 '<my:engine power="121" fuelConsumption="10" />' + 7 '</my:car>' + 8 '</my:root>'; 9 10const reader = new Reader(model); 11const rootHandler = reader.handler('my:Root'); 12 13// when 14try { 15 const { 16 rootElement: cars, 17 warnings 18 } = await reader.fromXML(xml, rootHandler); 19 20 if (warnings.length) { 21 console.log('import warnings', warnings); 22 } 23 24 console.log(cars); 25 26 // { 27 // $type: 'my:Root', 28 // cars: [ 29 // { 30 // $type: 'my:Car', 31 // id: 'Car_1', 32 // engine: [ 33 // { $type: 'my:Engine', powser: 121, fuelConsumption: 10 } 34 // ] 35 // } 36 // ] 37 // } 38 39} catch (err) { 40 console.log('import error', err, err.warnings); 41}
Write XML
Use the writer to serialize the object tree back to XML:
1var model; // previously created 2 3var cars = model.create('my:Root'); 4cars.get('cars').push(model.create('my:Car', { power: 10 })); 5 6var options = { format: false, preamble: false }; 7var writer = new Writer(options); 8 9var xml = writer.toXML(bar); 10 11console.log(xml); // <my:root xmlns:props="http://mypackage"> ... <my:car power="10" /></my:root>
License
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/bpmn-io/.github/SECURITY.md:1
- Info: Found linked content: github.com/bpmn-io/.github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/bpmn-io/.github/SECURITY.md:1
- Info: Found text in security policy: github.com/bpmn-io/.github/SECURITY.md:1
Reason
SAST tool detected but not run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Warn: 0 commits out of 26 are checked with a SAST tool
Reason
Found 6/11 approved changesets -- score normalized to 5
Reason
5 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-7q7g-4xm8-89cq
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/bpmn-io/moddle-xml/CI.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/bpmn-io/moddle-xml/CI.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CODE_SCANNING.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/bpmn-io/moddle-xml/CODE_SCANNING.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CODE_SCANNING.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/bpmn-io/moddle-xml/CODE_SCANNING.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CODE_SCANNING.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/bpmn-io/moddle-xml/CODE_SCANNING.yml/main?enable=pin
- Info: 0 out of 5 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/CI.yml:1
- Warn: no topLevel permission defined: .github/workflows/CODE_SCANNING.yml:1
- Info: no jobLevel write permissions found
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Score
4.8
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to moddle-xml
moddle
A library for importing meta-model based file formats into JS
oms-moddle-xml
XML import/export for documents described with moddle, based on bpmn-moddle-xml@9.0.4
moddle-xmi
pnml-moddle-converter
The pnml-moddle-converter is a TypeScript library that provides functionality for converting between PNML (Petri Net Markup Language) and Moddle XML formats. It includes classes for representing different elements of a Petri net, such as places, transitio