simplejs2xml

Simple JavaScript to XML serializer

npm install simplejs2xml
6 downloads in the last week
17 downloads in the last month

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

npm loves you