Xml
maintaining xml in pure javascript (IN BOTH NODE.JS & BROWSERS)
Install / Use
/learn @lite-js/XmlREADME
xml
Maintaining XML in pure javascript (IN BOTH NODE.JS & BROWSERS) Homepage
Maintaining?
Converting

Editing/Traversing
XMLLite.findChildNode(doc, query);
XMLLite.findChildNodes(doc, query);
XMLLite.findOrCreateChildNode(doc, query);
XMLLite.removeChildNode(doc, query);
XMLLite.eachChildNode(doc, query, callback);
// ...
Formatting
XMLLite.beautify(xml, indent);
XMLLite.uglify(xml, preserveComments);
XMLLite.sanitize(xml, reverse);
// ...
Actually, you can get the js object from XMLLite.xml2js(xml), do whatever you want, and convert it back to xml again with XMLLite.js2xml(obj).
Why?
- A reasonable need for usage in both Node.js and Browsers
- A more reasonable need to use native APIs(DOMParser/XMLSerializer) to speed up the maintaining process and keep the library thin
Why @lite-js/xml?
- It works exactly the same in both Node.js and Browsers
- The browser version is supper light-weight(dist/xml.js)
- Convenient APIs for converting between xml/js/json/DOM, and lots of helpers to maintain the data structures
- Super fast. it takes less than 30ms to convert an xml document with over 1,000 nodes into a js object
Install
$ npm install @lite-js/xml --save
$ npm install @lite-js/xml -g
Usage
In Node.js
const XML = require('@lite-js/xml');
Command line client
$ xml-lite --help
In browsers
<script src="$path/to/@lite-js/xml/dist/xml.js"> <!-- window.XML is available -->
In browsers with webpack
import XMLLite from '@lite-js/xml/indexBrowser';
Demo
API
JSON spec
Projects using @lite-js/xml
Contributing
known issues
Related Skills
node-connect
338.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
338.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.6kCommit, push, and open a PR
