Registry / serialization / xml-parser

xml-parser

JSON →
library0.1jsnpmunverified

The `xml-parser` library (current version 1.2.1) is a lightweight, non-compliant XML parser designed for parsing basic XML responses, primarily as an alternative to heavier, compile-time-intensive XML libraries like `libxml`. Its core differentiator is its simplicity and minimal footprint, making it suitable for niche use cases where full XML specification adherence is not required. It focuses on quickly extracting data from well-known, simple XML structures rather than validating or comprehensively parsing complex or edge-case XML documents. The package has seen no updates in over six years, indicating it is no longer actively maintained and should be used with caution, understanding its limitations regarding XML standard compliance and potential security implications of unpatched vulnerabilities. It primarily targets Node.js environments.

npm install xml-parser
INSTALL
IMPORT
SIG · XML-PARSER
X
xml-parser
serializationjavascriptv0.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
✓ const parse = require('xml-parser');
✗ import parse from 'xml-parser';
This library is CommonJS-only and does not support ES module imports. The default export is the parsing function.

Demonstrates parsing a sample SOAP XML response and pretty-printing the resulting JavaScript object structure.

const fs = require('fs'); const parse = require('xml-parser'); const inspect = require('util').inspect; // Simulate reading an XML file const xml = `<?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com"> <soapenv:Body> <createResponse> <result> <id>003D000000OY9omIAD</id> <success>true</success> </result> <result> <id>001D000000HTK3aIAH</id> <success>true</success> </result> </createResponse> </soapenv:Body> </soapenv:Envelope>`; const obj = parse(xml); console.log(inspect(obj, { colors: true, depth: Infinity }));
Debug
Known issues
gotchaThe parser is explicitly non-compliant with full XML specifications and is designed for basic, well-formed XML structures. It may not handle all valid XML features or edge cases correctly.
fix
Thoroughly test with your specific XML inputs. Do not use for parsing arbitrary or untrusted XML documents, as this could lead to unexpected parsing failures or security vulnerabilities if the parser is exposed to malformed input.
affects: >=1.0.0
breakingThe `xml-parser` package is no longer actively maintained, with the last commit over six years ago. This means it will not receive updates for new features, bug fixes, or security vulnerabilities.
fix
For new projects or if robust, secure, and fully compliant XML parsing is required, consider using actively maintained alternatives such as `fast-xml-parser` or `libxmljs`.
affects: >=1.0.0
gotchaThe library is CommonJS-only and does not natively support ES module (`import`) syntax, which is standard in modern JavaScript projects.
fix
Always use `const parse = require('xml-parser');` when importing this package in a Node.js environment. ES module imports will result in errors.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: parse is not a function
Attempting to use ES module `import parse from 'xml-parser';` syntax instead of CommonJS `require`.
fix
Change your import statement to `const parse = require('xml-parser');` to correctly load the module.
Unexpected token < at position X in XML string
The input XML is malformed, contains unescaped characters, or uses features not supported by this non-compliant parser, causing it to fail prematurely.
fix
Inspect the XML string for validity, ensure special characters are properly escaped, and verify that its structure is simple and consistent with what `xml-parser` is designed to handle. For complex or variable XML, consider a more robust parser.
Upgrade
Version history
0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
xml-parser — npm install xml-parser · libregistry