Skip to content

katapod/mini-xml

Repository files navigation

mini-xml

Build npm version Known Vulnerabilities

A small, fast, and simple XML parser for Node.js and the browser. Generate XML from json.

Usage

Setup

const miniXml = require('mini-xml');

or

import { generateXMLFromObject } from 'mini-xml';

Create XML from JSON

import { generateXMLFromObject } from 'mini-xml';

const json = {
    rss: {
      '@version': '2.0',
      channel: {
        title: 'W3Schools Home Page',
        link: 'https://www.w3schools.com',
        description: 'Free web building tutorials',
        item: [
          {
            title: 'RSS Tutorial',
            link: 'https://www.w3schools.com/xml/xml_rss.asp',
            description: 'New RSS tutorial on W3Schools',
          },
          {
            title: 'XML Tutorial',
            link: 'https://www.w3schools.com/xml',
            description: 'New XML tutorial on W3Schools',
          },
        ],
      },
    },
  };

const generatedXML = generateXMLFromObject(json);

TBA