Gathering detailed insights and metrics for super-xmlllint
Gathering detailed insights and metrics for super-xmlllint
Gathering detailed insights and metrics for super-xmlllint
Gathering detailed insights and metrics for super-xmlllint
npm install super-xmlllint
Typescript
Module System
Node Version
NPM Version
63.6
Supply Chain
98.8
Quality
75.5
Maintenance
100
Vulnerability
100
License
TypeScript (62.3%)
JavaScript (37.7%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
1 Stars
24 Commits
2 Forks
1 Watchers
1 Branches
2 Contributors
Updated on Jun 10, 2021
Latest Version
1.0.6
Package Id
super-xmlllint@1.0.6
Unpacked Size
11.60 kB
Size
3.69 kB
File Count
8
NPM Version
6.14.7
Node Version
14.7.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Wrapper for xmllint
. Easy validation of XML. XML Schemas and DTDs supported. c14n, c14n11 and c14n-exc canoncalization.
Fork from project validate-with-xmllint
function validateXML(input: string | Buffer): Promise<xmllintOutput>
function validateXMLWithDTD(input: string | Buffer): Promise<xmllintOutput>
function validateXMLWithXSD(input: string | Buffer, xsdfile: string | Buffer): Promise<void>
function canonicalizeXML(input: string | Buffer, method: 'c14n' | 'c14n11' | 'exc-c14n' = 'exc-c14n'): Promise<xmllintOutput>
xmllint
is verified during installation timeThe interface of the xmllintOutput format is
code: number, // Returned status code
command: string, // Used command
output: string // Output data
1const { 2 validateXML, 3 validateXMLWithDTD, 4 validateXMLWithXSD, 5 canonicalizeXML 6} = require("validate-with-xmllint");
All the examples below return promises which will eventually resolve.
1validateXML("<hello>world!</hello>"); 2validateXML("<tiny/>"); 3 4/** 5 * All referenced DTD's must be available locally as `xmllint` 6 * is invoked with `--nonet` which prevents network connections 7 **/ 8validateXMLWithDTD( 9 `<?xml version="1.0" encoding="utf-8"?> 10 <!DOCTYPE root SYSTEM "./test/dtds/valid-dtd.dtd"> 11 <root> 12 <body/> 13 <body/> 14 </root>` 15); 16 17/** 18 * Path to XSD Schema file must be provided with the document 19 **/ 20validateXMLWithXSD( 21 `<?xml version="1.0"?> 22 <root> 23 <text> 24 DEMO 25 </text> 26 <body> 27 <name>foo</name> 28 </body> 29 </root>`, 30 "./test/xsds/valid-xsd.xsd" 31);
All the examples below return promises which will eventually reject with the output from xmllint
.
1validateXML("<open_tag_only>"); 2validateXML("garbage"); 3 4validateXMLWithDTD( 5 `<?xml version="1.0" encoding="utf-8"?> 6 <!DOCTYPE root SYSTEM "./test/dtds/valid-dtd.dtd"> 7 <this> 8 Not allowed by the dtd! 9 </this>` 10); 11 12validateXMLWithXSD( 13 `<?xml version="1.0"?> 14 <root> 15 <something_unexpected_here/> 16 </root>`, 17 "./test/xsds/valid-xsd.xsd" 18);
See more demos within the tests.
How to install
xmllint
?
You might already have it. Execute xmllint --version
and see what it prints out.
On Debian distros look up libxml2-utils
, on RedHat libxml2
. A recent version of xmllint
should be bundled by default on MacOS.
This pacakge runs a postinstall script to verify that you have xmllint
available.
How to see the actual errors in my XML?
The promise is rejected with the error output from xmllint
. The error contains all the available details. Expect to see something like this:
Error: xmllint exited with code 3 when executed with xmllint --schema /Users/aautio/foobar/validate-with-xmllint/test/xsds/valid-xsd.xsd --noout --nonet -:
-:2: element root: Schemas validity error : Element 'root': Missing child element(s). Expected is ( body ).
- fails to validate
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/23 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
18 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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