{"id":14377,"library":"xml-parser","title":"xml-parser","description":"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.","status":"abandoned","version":"1.2.1","language":"javascript","source_language":"en","source_url":"git://github.com/segmentio/xml-parser","tags":["javascript","xml","sucks"],"install":[{"cmd":"npm install xml-parser","lang":"bash","label":"npm"},{"cmd":"yarn add xml-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add xml-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This library is CommonJS-only and does not support ES module imports. The default export is the parsing function.","wrong":"import parse from 'xml-parser';","symbol":"parse","correct":"const parse = require('xml-parser');"}],"quickstart":{"code":"const fs = require('fs');\nconst parse = require('xml-parser');\nconst inspect = require('util').inspect;\n\n// Simulate reading an XML file\nconst xml = `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n   xmlns=\"urn:enterprise.soap.sforce.com\">\n   <soapenv:Body>\n      <createResponse>\n         <result>\n            <id>003D000000OY9omIAD</id>\n            <success>true</success>\n         </result>\n         <result>\n            <id>001D000000HTK3aIAH</id>\n            <success>true</success>\n         </result>\n      </createResponse>\n   </soapenv:Body>\n </soapenv:Envelope>`;\n\nconst obj = parse(xml);\nconsole.log(inspect(obj, { colors: true, depth: Infinity }));","lang":"javascript","description":"Demonstrates parsing a sample SOAP XML response and pretty-printing the resulting JavaScript object structure."},"warnings":[{"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.","message":"The 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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`.","message":"The `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.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Always use `const parse = require('xml-parser');` when importing this package in a Node.js environment. ES module imports will result in errors.","message":"The library is CommonJS-only and does not natively support ES module (`import`) syntax, which is standard in modern JavaScript projects.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.2.1':11 'activ':105 'adher':60 'altern':29 'basic':23 'case':55,87 'caution':112 'compil':33 'compile-time-intens':32 'complex':83 'complianc':119 'compliant':17 'comprehens':81 'core':41 'current':9 'data':69 'design':20 'differenti':42 'document':89 'edg':86 'edge-cas':85 'environ':131 'extract':68 'focus':65 'footprint':48 'full':57 'heavier':31 'implic':123 'indic':100 'intens':35 'javascript':132 'known':73 'librari':8,37 'libxml':39 'lightweight':14 'like':38 'limit':115 'longer':104 'maintain':106 'make':49 'minim':47 'nich':53 'node.js':130 'non':16 'non-compli':15 'packag':91 'pars':22,82 'parser':3,7,19 'potenti':121 'primarili':26,128 'quick':67 'rather':77 'regard':116 'requir':63 'respons':25 'secur':122 'seen':93 'simpl':74 'simplic':45 'six':98 'specif':59 'standard':118 'structur':76 'suck':134 'suitabl':51 'target':129 'time':34 'understand':113 'unpatch':125 'updat':95 'use':54,110 'valid':79 'version':10 'vulner':126 'well':72 'well-known':71 'xml':2,6,18,24,36,58,75,88,117,133 'xml-parser':1,5 'year':99","created_at":"2026-04-20T01:59:23.913552+00:00","updated_at":"2026-04-20T01:59:23.913552+00:00","problems":[{"fix":"Change your import statement to `const parse = require('xml-parser');` to correctly load the module.","cause":"Attempting to use ES module `import parse from 'xml-parser';` syntax instead of CommonJS `require`.","error":"TypeError: parse is not a function"},{"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.","cause":"The input XML is malformed, contains unescaped characters, or uses features not supported by this non-compliant parser, causing it to fail prematurely.","error":"Unexpected token < at position X in XML string"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/segmentio/xml-parser","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/xml-parser","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}