@xmldom/xmldom
A pure JavaScript, W3C-standard DOMParser and XMLSerializer for parsing and building XML/HTML documents
Repository Health
Technical Analysis
@xmldom/xmldom is a dependency-free JavaScript implementation of the DOM Level 2 Core API, providing DOMParser and XMLSerializer classes that work identically in Node.js and browsers. It exists to fill the gap left by document.implementation not being available server-side, giving Node code (and any environment lacking a native DOM) a spec-compliant way to parse XML/HTML strings into a traversable DOM tree and serialize a tree back to a string.
What You Get
- A
DOMParserclass withparseFromString()that turns an XML or HTML string into a standards-compliant DOMDocument - An
XMLSerializerclass that turns a DOM tree back into a string, mirroring the browser API - A hand-written SAX-style tokenizer (
lib/sax.js) and grammar module underpinning the parser, with no native bindings or WASM to install - Configurable error/warning handling via
onErrorcallbacks so malformed input can be caught instead of silently producing a broken tree
Common Use Cases
- Parsing XML config files, SOAP responses, RSS/Atom feeds, or SVG documents in a Node.js backend with no DOM available
- Server-side rendering or testing code that expects browser DOM APIs (
DOMParser/XMLSerializer) but runs outside a browser - Feeding parsed documents into XPath libraries (e.g.
xpath) that expect a DOM Level 2 tree to query against - Manipulating and re-serializing HTML/XML documents in build tools, static site generators, or CLI utilities
Under The Hood
Architecture The library is organized around a small set of focused modules: sax.js implements a hand-rolled streaming tokenizer that walks the input string and emits parse events; dom-parser.js consumes those events to build up a DOM tree using the Document/Node/Element classes defined in the large dom.js (3,500+ lines implementing DOM Level 2 Core); entities.js handles the full HTML/XML named-entity decoding table; and errors.js/conventions.js centralize error typing and shared helpers. There is no external parsing dependency — the tokenizer, grammar, and DOM implementation are all original code. Tech Stack Pure JavaScript (CommonJS, lib/index.js as the entry point) with hand-authored TypeScript declarations (index.d.ts) shipped alongside rather than generated from source; zero runtime dependencies keep the install footprint small, and the dev toolchain uses Jest for testing, ESLint/Prettier for style, and auto-changelog for release notes. Code Quality The test suite is substantial — 64+ test files under test/ covering dom, dom-parser, entities, errors, grammar, HTML parsing, and dedicated conformance/parse suites, plus a jest.fuzz.config.js for fuzz testing malformed input, which is unusually thorough for a parser library and reflects real-world hardening against XML edge cases (external entities, malformed tags, encoding quirks). API Design The public API deliberately mirrors the browser’s native DOMParser/XMLSerializer interfaces, so code written against real browser DOM parsing can often switch to this package with a single import change and no rewrites; the tradeoff is that advanced configuration (custom error handling, MIME type selection) requires reaching for slightly less-discoverable constructor options rather than a fluent builder API.
Used by 12 apps in this directory
AionUi
AI Agents · Productivity
Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.
FastGPT
AI Agents · AI Development
Build, debug, and deploy knowledge-based AI agents with a visual workflow editor, RAG retrieval, and support for any OpenAI-compatible LLM.
Jitsi Meet
Team Chat · Collaboration · Video Conferencing
Open-source, end-to-end encrypted video conferencing you can self-host or embed into any web or mobile app.
LobeHub
AI Assistants · Productivity · Automation
Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.
nango
Developer Tools · Automation · Authentication
Build product integrations with AI using 800+ APIs — auth, proxy, and TypeScript functions on production-grade infrastructure.
Next AI Draw.io
Developer Tools · AI Design Tools · Design Tools
Turn natural language into professional draw.io diagrams with AI, cloud icons, and an MCP server for your IDE.
NodeBB
Community
Modern Node.js forum software with real-time WebSockets, multi-database support, and a plugin ecosystem — the community platform built for the open web and the Fediverse.
OneUptime
Monitoring
The complete open-source observability platform that replaces PagerDuty, Datadog, Sentry, and StatusPage with a single self-hostable system.
overleaf
Collaboration · Productivity
Open-source, real-time collaborative LaTeX editor with sandboxed compilation and full TeXLive support for self-hosted academic and research teams.