npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

xml-toolkit

v1.1.8

Published

A pure Node.js library for solving diverse XML-related application tasks with minimal resources and dependencies

Readme

workflow Jest coverage Ask DeepWiki npm version License: MIT

A pure Node.js library for solving diverse XML-related application tasks with minimal resources and dependencies.

node-xml-toolkit handles XML parsing, marshalling, and SOAP integration — from streaming multi-gigabyte files to invoking SOAP 1.1 web services via WSDL.


✨ Features

  • Dual parsing modes: Fast synchronous parser for small documents; streaming asynchronous parser for large files
  • 🧠 Memory-efficient: Scan multi-GB XML files with limited buffer
  • 🧬 Schema support: Validate and serialize objects using XML Schema (XSD)
  • 🧼 SOAP 1.1, 1.2 adapters: Invoke web services directly from WSDL + plain JS objects
  • 🖨️ Flexible output: Format, patch, or transform XML with configurable options
  • 🎏 Stream-ready: Works with Node.js streams, async iterators, and event emitters

📦 Installation

npm install xml-toolkit

🚀 Quick Start

Parse a Small XML File (Sync)

const fs = require('fs');
const { XMLParser, XMLSchemata } = require('xml-toolkit');

const xml = fs.readFileSync('doc.xml');
const parser = new XMLParser(); // optionally: { xs: new XMLSchemata('schema.xsd') }
const document = parser.process(xml);

for (const element of document.detach().children) {
  console.log(element.attributes);
}

Stream Large XML Files (Async)

const { XMLReader, XMLNode } = require('xml-toolkit');

const records = new XMLReader({
  filterElements: 'Record',
  map: XMLNode.toObject({})
}).process(xmlSource);

// Use as async iterator
for await (const record of records) {
  // process each record
}

// Or pipe to another stream
// records.pipe(nextStream);

Extract a Single Element

const { XMLReader, XMLNode } = require('xml-toolkit');

const data = await new XMLReader({
  filterElements: 'MyElementName',
  map: XMLNode.toObject({})
}).process(xmlSource).findFirst();

Format / Pretty-Print XML

const { XMLParser } = require('xml-toolkit');

const formatted = new XMLParser()
  .process(fs.readFileSync('doc.xml'))
  .toString({
    space: '\t',        // indentation
    // EOL: '\n',        // line ending
    // encodeLineBreaks: false
  });

Serialize Objects to XML (via XSD)

const { XMLSchemata } = require('xml-toolkit');

const data = { ExportDebtRequestsResponse: { 'request-data': { /* ... */ } } };
const xs = new XMLSchemata('schema.xsd');
const xml = xs.stringify(data);
// → <ns0:ExportDebtRequestsResponse xmlns:ns0="urn:...">...

Invoke a SOAP 1.1 Web Service

const http = require('http');
const { SOAP11 } = require('xml-toolkit');

const soap = new SOAP11('service.wsdl');
const { method, headers, body } = soap.http({
  RequestElementNameOfTheirs: { amount: '0.01' }
});

const req = http.request(endpointURL, { method, headers });
req.write(body);
req.end();

🧭 Core API Overview

| Class / Export | Purpose | Mode | |--------------------|----------------------------------------------|------------| | XMLParser | Synchronous full-document parsing | Sync | | XMLReader | Streaming parser with filtering & mapping | Async/Stream | | XMLNode | DOM-like node representation + utilities | Both | | XMLSchemata | XSD-based validation & object→XML serialization | Both | | SOAP | SOAP adapter using WSDL | Sync setup |


⚠️ Limitations

  • No DTD support: Entity declarations may cause parser errors
  • 🧪 XML Schema is "forever beta": Features like xs:unique are not implemented; validation coverage is partial
  • 🔍 For production-grade validation, consider external tools like xmllint (used in the library's test suite)

💡 Motivation

Node.js lacks built-in XML tooling comparable to Java's JAXB/JAX-WS. While many pure-JS XML modules exist, node-xml-toolkit was created to deliver most necessary functions with:

  • ✅ Minimal computing resources
  • ✅ Minimal application code
  • Almost no external dependencies

All in a pure JavaScript implementation.


📄 License

MIT © do-


🔗 Links