I suggest xml2js, a simple XML to JavaScript object converter. You can then iterate the resulting object. Code snippet from the page :
var parseString = require('xml2js').parseString;
var xml = "<root>Hello xml2js!</root>"
parseString(xml, function (err, result) {
console.dir(result);
});
You can install it by using npm install xml2js
npm
npmjs.com › package › xml-parse-from-string
xml-parse-from-string - npm
May 18, 2017 - Parses the string as XML and returns the root element as a DOM element, so you can do operations similar to document.getElementById, document.getElementsByTagName, and so forth.
» npm install xml-parse-from-string
Published May 18, 2017
Version 1.0.1
Author Matt DesLauriers
Top answer 1 of 4
14
I suggest xml2js, a simple XML to JavaScript object converter. You can then iterate the resulting object. Code snippet from the page :
var parseString = require('xml2js').parseString;
var xml = "<root>Hello xml2js!</root>"
parseString(xml, function (err, result) {
console.dir(result);
});
You can install it by using npm install xml2js
2 of 4
3
There are a variety of XML modules listed here where perhaps you may find one that works best for you. A popular one that I'm aware of is sax-js. There are also libxml bindings if you're already familiar with that library.
npm
npmjs.com › package › to-xml
to-xml - npm
» npm install to-xml
Published Aug 21, 2023
Version 0.1.11
Author Yusuke Kawasaki
Repository https://github.com/kawanet/to-xml
npm
npmjs.com › package › xml-js
xml-js - npm
February 13, 2019 - Reversible: Whether converting xml→json or json→xml, the result can be converted back to its original form. Minimal Dependencies: This library depends only on one external npm module.
» npm install xml-js
Published Feb 13, 2019
Version 1.6.11
Author Yousuf Almarzooqi
Repository https://github.com/nashwaan/xml-js
LogRocket
blog.logrocket.com › home › reading and writing xml in node.js
Reading and writing XML in Node.js - LogRocket Blog
June 4, 2024 - In this article, we will explore some real-world XML use cases using some of the most popular npm packages available, including: ... Note that the code examples in this article are for demonstration purposes. Elaborate, working sample code is available at briandesousa/node-xml-demo. If you want to follow along with the instructions in this article, you may want to start by generating an Express app with express-generator.
npm
npmjs.com › package › fast-xml-parser
fast-xml-parser - npm
6 days ago - Validate XML, Parse XML, Build XML without C/C++ based libraries. Latest version: 5.5.9, last published: 5 days ago. Start using fast-xml-parser in your project by running `npm i fast-xml-parser`. There are 3909 other projects in the npm registry using fast-xml-parser.
» npm install fast-xml-parser
Published Mar 23, 2026
Version 5.5.9
Author Amit Gupta
npm
npmjs.com › package › xml-string
xml-string - npm
February 10, 2020 - Latest version: 2.0.2, last published: 6 years ago. Start using xml-string in your project by running `npm i xml-string`. There are 3 other projects in the npm registry using xml-string.
» npm install xml-string
GitHub
github.com › jhuckaby › pixl-xml
GitHub - jhuckaby/pixl-xml: A simple module for parsing and composing XML. · GitHub
Can parse XML strings, Buffers or load from files · Can preserve or flatten attributes · Can convert all keys to lower-case · Can serialize objects back to pretty-printed or compact XML · Use npm to install the module: npm install pixl-xml · ...
Starred by 78 users
Forked by 19 users
Languages JavaScript
npm
npmjs.com › package › xml-core
xml-core - npm
npm install xml-core · Convert XML to JSON and JSON to XML with schema enforcement · TypeScript decorators for XML element definitions · Support for attributes, child elements, and content · Cross-platform compatibility (browser and Node.js) import { XmlObject, XmlElement, XmlAttribute, XmlChildElement } from "xml-core"; @XmlElement({ localName: "Person" }) class Person extends XmlObject { @XmlAttribute({ localName: "id" }) public id: string = ""; @XmlChildElement({ localName: "Name" }) public name: string = ""; } // Parse XML const person = new Person(); person.LoadXml('<Person id="123"><
» npm install xml-core
Published Dec 15, 2025
Version 1.2.5
Author Peculiar Ventures LLC
npm
npmjs.com › package › xml-parse
xml-parse - npm
November 6, 2019 - Parse XML, HTML and more with a very tolerant XML parser and convert it into a DOM. These three components are separated from each other as own modules. npm install xml-parse · const xml = require("xml-parse"); Parsing is very simple.
» npm install xml-parse
Published Nov 06, 2019
Version 0.4.0
Author Maurice Conrad
Repository https://github.com/MauriceConrad/XML-Parser
npm
npmjs.com › package › jsontoxml
jsontoxml - npm
This is a library designed to render js objects as xml. Its not made to parse or otherwise edit existing xml/html structures.. Latest version: 1.0.1, last published: 7 years ago. Start using jsontoxml in your project by running `npm i jsontoxml`. There are 132 other projects in the npm registry ...
» npm install jsontoxml
npm
npmjs.com › search
json to xml - npm search
A library for fast JSON to XML transformations.
npm
npmjs.com › package › xml2js
xml2js - npm
You can create one xml2js.Parser per file. That's the recommended one and is promised to always just work. You can call reset() on your parser object. You can hope everything goes well anyway. This behaviour is not guaranteed work always, if ever. Use option #1 if possible. Thanks! Just wrap the result object in a call to JSON.stringify like this JSON.stringify(result).
» npm install xml2js
Published Jul 26, 2023
Version 0.6.2
Author Marek Kubica
npm
npmjs.com › package › xml-element-string
xml-element-string - npm
June 12, 2016 - Takes a tag-name, attributes object, and an array of children and turns them into an xml string. Latest version: 1.0.0, last published: 9 years ago. Start using xml-element-string in your project by running `npm i xml-element-string`. There ...
» npm install xml-element-string
Published Jun 12, 2016
Version 1.0.0
Author Mike Cousins
GitHub
github.com › ElyaConrad › XML-Parser
GitHub - ElyaConrad/XML-Parser: A Node.js XML DOM, Parser & Stringifier. · GitHub
Just call the parse method of the xml-parse instance. const xml = require("xml-parse"); // Valid XML string var parsedXML = xml.parse('<?xml version="1.0" encoding="UTF-8"?>' + '<root>Root Element</root>'); console.log(parsedXML); // Invalid ...
Starred by 18 users
Forked by 7 users
Languages JavaScript
npm
npmjs.com › package › xmlbuilder
xmlbuilder - npm
April 8, 2020 - An XML builder for node.js similar to java-xmlbuilder.
» npm install xmlbuilder
Published Apr 08, 2020
Version 15.1.1
Author Ozgur Ozcitak
Repository https://github.com/oozcitak/xmlbuilder-js