A simple XML parser and formatter for JavaScript, currently at version 2.0.0 (work in progress). It ships TypeScript type definitions. Release cadence is unknown due to early stage. Key differentiators: minimal API for parsing and building XML, intended for both Node.js and browser. Alternative to xml2js but lighter with fewer dependencies.
npm install js-xmlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows parsing an XML string into a JS object and building XML from an object using the library's two main exports.
Switch from require() to import statements. Set 'type': 'module' in package.json or use .mjs extension.
Replace 'import jsxml from 'js-xml'' with 'import { parseXML, formatXML, XMLBuilder } from 'js-xml''.Always check if parseXML result is null before accessing properties.
Use dynamic import() or convert your project to ESM.
Run 'npm install js-xml@2' and ensure package.json has type:module.
Use 'import { parseXML } from 'js-xml''.No dependency data recorded yet.