writexml

Generate xml file from data.

Usage no npm install needed!

<script type="module">
  import writexml from 'https://cdn.skypack.dev/writexml';
</script>

README

writexml

Build Status npm Version JS Standard

Generate xml file from data.

Installation

npm install writexml --save

Usage

'use strict'

const fs = require('fs')
const writexml = require('writexml')

writexml('person-file.xml', 'person', {
  'telephone': [
    '123-555-4567',
    {
      '#': '789-555-4567',
      '=': 'fax'
    },
    '456-555-7890'
  ]
}).then(() => {
  /* ... */
  fs.readFile('person-file.xml', (err, content) => {
    console.log(content)
    // <?xml version='1.0' encoding='UTF-8'?>
    // <person>
    //     <telephone>123-555-4567</telephone>
    //     <fax>789-555-4567</fax>
    //     <telephone>456-555-7890</telephone>
    // </person>
  })
})

License

This software is released under the MIT License.