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 = ; var serialized = xml;
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 emitjs: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 (defaulthttp://www.example.org/js2xml
).defaultPrefix
- the namespace prefix for elements generated by the module for anonymous objects, arrays and values (defaultjs
).
Examples
TBD