simplejs2xml
v0.1.2
Published
Simple JavaScript to XML serializer
Downloads
7
Readme
node-js2xml
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 js2xml 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('js2xml');
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