Gathering detailed insights and metrics for saxen
Gathering detailed insights and metrics for saxen
Gathering detailed insights and metrics for saxen
Gathering detailed insights and metrics for saxen
A tiny, super fast, namespace aware, sax-style XML parser.
npm install saxen
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.6
Supply Chain
99.6
Quality
76.2
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
12,588,301
Last Day
3,323
Last Week
98,938
Last Month
434,977
Last Year
4,203,043
MIT License
19 Stars
333 Commits
4 Forks
4 Watchers
1 Branches
1 Contributors
Updated on Apr 14, 2025
Latest Version
10.0.0
Package Id
saxen@10.0.0
Unpacked Size
146.14 kB
Size
25.53 kB
File Count
7
NPM Version
10.2.4
Node Version
20.11.1
Published on
Mar 05, 2024
Cumulative downloads
Total Downloads
Last Day
-0.7%
3,323
Compared to previous day
Last Week
-9.7%
98,938
Compared to previous week
Last Month
9.7%
434,977
Compared to previous month
Last Year
49%
4,203,043
Compared to previous year
7
/saxen/
parserA tiny, super fast, namespace aware sax-style XML parser written in plain JavaScript.
2.6Kb
minified + gzipped)1var { 2 Parser 3} = require('saxen'); 4 5var parser = new Parser(); 6 7// enable namespace parsing: element prefixes will 8// automatically adjusted to the ones configured here 9// elements in other namespaces will still be processed 10parser.ns({ 11 'http://foo': 'foo', 12 'http://bar': 'bar' 13}); 14 15parser.on('openTag', function(elementName, attrGetter, decodeEntities, selfClosing, getContext) { 16 17 elementName; 18 // with prefix, i.e. foo:blub 19 20 var attrs = attrGetter(); 21 // { 'bar:aa': 'A', ... } 22}); 23 24parser.parse('<blub xmlns="http://foo" xmlns:bar="http://bar" bar:aa="A" />');
We support the following parse hooks:
openTag(elementName, attrGetter, decodeEntities, selfClosing, contextGetter)
closeTag(elementName, decodeEntities, selfClosing, contextGetter)
error(err, contextGetter)
warn(warning, contextGetter)
text(value, decodeEntities, contextGetter)
cdata(value, contextGetter)
comment(value, decodeEntities, contextGetter)
attention(str, decodeEntities, contextGetter)
question(str, contextGetter)
In contrast to error
, warn
receives recoverable errors, such as malformed attributes.
In proxy mode, openTag
and closeTag
a view of the current element replaces the raw element name. In addition element attributes are not passed as a getter to openTag
. Instead, they get exposed via the element.attrs
:
openTag(element, decodeEntities, selfClosing, contextGetter)
closeTag(element, selfClosing, contextGetter)
In namespace mode, the parser will adjust tag and attribute namespace prefixes before
passing the elements name to openTag
or closeTag
. To do that, you need to
configure default prefixes for wellknown namespaces:
1parser.ns({ 2 'http://foo': 'foo', 3 'http://bar': 'bar' 4});
To skip the adjustment and still process namespace information:
1parser.ns();
In this mode, the first argument passed to openTag
and closeTag
is an object that exposes more internal XML parse state. This needs to be explicity enabled by instantiating the parser with { proxy: true }
.
1// instantiate parser with proxy=true 2var parser = new Parser({ proxy: true }); 3 4parser.ns({ 5 'http://foo-ns': 'foo' 6}); 7 8parser.on('openTag', function(el, decodeEntities, selfClosing, getContext) { 9 el.originalName; // root 10 el.name; // foo:root 11 el.attrs; // { 'xmlns:foo': ..., id: '1' } 12 el.ns; // { xmlns: 'foo', foo: 'foo', foo$uri: 'http://foo-ns' } 13}); 14 15parser.parse('<root xmlns:foo="http://foo-ns" id="1" />')
Proxy mode comes with a performance penelty of roughly five percent.
Caution! For performance reasons the exposed element is a simple view into the current parser state. Because of that, it will change with the parser advancing and cannot be cached. If you would like to retain a persistent copy of the values, create a shallow clone:
1parser.on('openTag', function(el) { 2 var copy = Object.assign({}, el); 3 // copy, ready to keep around 4});
/saxen/
lacks some features known in other XML parsers such as sax-js:
...and that is ok ❤.
We build on the awesome work done by easysax.
/saxen/
is named after Sachsen, a federal state of Germany. So geht sächsisch!
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
Found 0/24 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
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
Score
Last Scanned on 2025-06-23
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