simplejs2xml

0.1.2 • Public • Published

node-js2xml (simplejs2xml)

This provides a very simple JavaScript to XML module for node.js, based on the Genx package.

The intent is only to provide a very basic serialization at this time, some options are available

Install

The usual, npm, add a dependency in your package.json to simplejs2xml and run:

$ npm install

API

The module only supports a single method, toXml(object, [options]) that will perform a simple serialization of the passed in JavaScript object.

var xml = require('simplejs2xml');
 
var serialized = xml.toXml({name: 'example', version: 3}, {});

The following options are supported:

  • rootName - where the passed object is a JavaScript object we do not have an element name by default, we would typically emit js:Object however you can pass in a name string to override this.
  • defaultUrl - the namespace URL for elements generated by the module for anonymous objects, arrays and values (default http://www.example.org/js2xml).
  • defaultPrefix - the namespace prefix for elements generated by the module for anonymous objects, arrays and values (default js).

Examples

TBD

/simplejs2xml/

    Package Sidebar

    Install

    npm i simplejs2xml

    Weekly Downloads

    3

    Version

    0.1.2

    License

    none

    Last publish

    Collaborators

    • skjohnston