An XML serializer that follows the W3C specification.
Installations
npm install w3c-xmlserializer
Score
99.4
Supply Chain
80.1
Quality
81.8
Maintenance
100
Vulnerability
100
License
Developer
jsdom
Developer Guide
Module System
CommonJS
Min. Node Version
>=18
Typescript Support
No
Node Version
21.1.0
NPM Version
10.2.0
Statistics
21 Stars
51 Commits
10 Forks
5 Watching
1 Branches
8 Contributors
Updated on 11 May 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
3,541,566,618
Last day
-8.5%
4,351,627
Compared to previous day
Last week
1.7%
25,587,463
Compared to previous week
Last month
17%
103,021,237
Compared to previous month
Last year
12.9%
1,012,503,755
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
3
w3c-xmlserializer
An XML serializer that follows the W3C specification.
This package can be used in Node.js, as long as you feed it a DOM node, e.g. one produced by jsdom.
Basic usage
Assume you have a DOM tree rooted at a node node
. In Node.js, you could create this using jsdom as follows:
1const { JSDOM } = require("jsdom"); 2 3const { document } = new JSDOM().window; 4const node = document.createElement("akomaNtoso");
Then, you use this package as follows:
1const serialize = require("w3c-xmlserializer"); 2 3console.log(serialize(node)); 4// => '<akomantoso xmlns="http://www.w3.org/1999/xhtml"></akomantoso>'
requireWellFormed
option
By default the input DOM tree is not required to be "well-formed"; any given input will serialize to some output string. You can instead require well-formedness via
1serialize(node, { requireWellFormed: true });
which will cause Error
s to be thrown when non-well-formed constructs are encountered. Per the spec, this largely is about imposing constraints on the names of elements, attributes, etc.
As a point of reference, on the web platform:
- The
innerHTML
getter uses the require-well-formed mode, i.e. trying to get theinnerHTML
of non-well-formed subtrees will throw. - The
xhr.send()
method does not require well-formedness, i.e. sending non-well-formedDocument
s will serialize and send them anyway.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/jsdom/.github/SECURITY.md:1
- Info: Found linked content: github.com/jsdom/.github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/jsdom/.github/SECURITY.md:1
- Info: Found text in security policy: github.com/jsdom/.github/SECURITY.md:1
Reason
2 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/jsdom/w3c-xmlserializer/build.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/jsdom/w3c-xmlserializer/build.yml/main?enable=pin
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
Found 5/25 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/build.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
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'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 16 are checked with a SAST tool
Score
4.2
/10
Last Scanned on 2024-11-25
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 More