This package, `xmllint`, is an Emscripten port of `libxml2`'s `xmllint` command-line tool, enabling XML schema validation directly within Node.js environments and web browsers. It provides a JavaScript API, primarily `xmllint.validateXML`, to check XML against XSD or RelaxNG schemas. The current stable version is 0.1.1, which was last published to npm approximately 10 years ago. The package is largely unmaintained, with its GitHub repository showing minimal activity for several years. A key differentiator at the time of its release was bringing robust XML validation (from the native `libxml2`) to JavaScript without native bindings, relying instead on Emscripten compilation. Due to its abandonment, modern projects are advised to consider the actively maintained `xmllint-wasm` fork, which offers WebAssembly support, updated `libxml2` versions, and an expanded API.
npm install xmllintVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `xmllint.validateXML` to validate XML strings against single or multiple XSD schemas, showcasing both successful and erroneous validation scenarios.
Migrate to `xmllint-wasm`. This typically involves `npm uninstall xmllint` and then `npm install xmllint-wasm`. Note that `xmllint-wasm` has a different API and requires Node.js 16+ or modern browsers with WebAssembly support.
For new projects or existing projects sensitive to bundle size, consider `xmllint-wasm` which outputs WebAssembly, resulting in a smaller combined library size (around 860KB for wasm and JS wrappers). Alternatively, explore server-side validation or more lightweight JavaScript XML parsing/validation libraries if your use case permits.
Ensure your build tooling (e.g., Webpack, Rollup) is configured to handle CommonJS modules when consuming this package. If you are using native ESM, you will likely need a transpilation step. For modern applications, `xmllint-wasm` offers better ESM compatibility.
If in a Node.js CJS environment, ensure `const xmllint = require('xmllint');` is used. In a browser or ESM context, ensure your bundler is correctly configured to handle CommonJS modules. Consider migrating to `xmllint-wasm` for better ESM support.Verify that you are importing the entire `xmllint` module as a default (CommonJS `require`) and then calling the `validateXML` method on the imported object, e.g., `const xmllint = require('xmllint'); xmllint.validateXML(...)`.For large XML files or performance-critical applications, consider using `xmllint-wasm`, which has introduced `--stream` option support and uses WebAssembly for improved performance and efficiency. Alternatively, offload validation to a server-side process using a native `xmllint` executable or a purpose-built XML parser.
No dependency data recorded yet.