Convert XML To JavaScript Object – from-xml

Category: Javascript | February 20, 2023
Author:kawanet
Views Total:426 views
Official Page:Go to website
Last Update:February 20, 2023
License:MIT

Preview:

Convert XML To JavaScript Object – from-xml

Description:

A tiny XML To JS Object converter library that works with both browser and node.js.

See Also:

How to use it:

1. Import the from-xml.js.

// Browser
<script src="dist/from-xml.min.js"></script>
// Node
const fromXML = require("from-xml").fromXML;

2. Convert an XML string to a JavaScript object.

const xml = '<xml css="script"><javascript><html>css</html></javascript></xml>'
const data = fromXML(XML);
// {...}
console.warn(data);
// => css
console.warn(data.xml.javascript.html);
// => script
console.warn(data.xml["@css"]);

Changelog:

02/20/2023

  • v0.1.9

You Might Be Interested In:


Leave a Reply