Saxen is a minimalistic, high-performance SAX-style XML parser designed for JavaScript environments, primarily Node.js. It distinguishes itself by being extremely lightweight (around 2.6KB minified + gzipped) and fast, while offering essential features like optional namespace awareness and entity decoding. The current stable version is 11.0.2, with major versions introducing significant breaking changes, such as the transition to an ESM-only distribution in v11 and stricter Node.js version requirements. Its design prioritizes speed and small footprint, making it suitable for applications where parsing efficiency is critical, and a full DOM parser is unnecessary. Saxen provides a stream of events (`openTag`, `closeTag`, `text`, `error`, etc.) that developers can hook into to process XML data incrementally, and supports an optional "proxy mode" for richer element state at a minor performance cost. Unlike some other parsers, it explicitly eschews certain features to maintain its focus on core SAX parsing.
npm install saxenVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of the `Parser` class, including event-based parsing, namespace configuration, handling various XML events, and an example of the optional proxy mode.
Migrate your project to use ECMAScript Modules (ESM) with `import { Parser } from 'saxen';` or ensure your Node.js environment supports ESM.Ensure your Node.js runtime is updated to version 20.12 or higher. Earlier versions will not be supported.
If you need to retain a persistent copy of the element's state from a specific event, create a shallow clone using `const copy = Object.assign({}, el);`.Update your import statement to `import { Parser } from 'saxen';` and ensure your project is configured for ESM (e.g., by adding `"type": "module"` to your `package.json` or using `.mjs` file extensions).Ensure you are using the correct named import for ESM: `import { Parser } from 'saxen';`.Set `"type": "module"` in your `package.json` or rename your file to use the `.mjs` extension. Alternatively, you might need to transpile your code if targeting older Node.js versions or browser environments without native ESM support.
No dependency data recorded yet.