Convert object to XML easy
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
example.js
index.js
package.json

README.md

toXML

Easily converts object to xml representation.

Installation

$ npm install toxml

Example

var toxml = require('toxml');
var xml = toxml({
    'root' : {
        'first' : 'param1',
        'child' : {
            '_attr' : {
                'xmlns' : 'http://com.example.webservice/',
                'lang' : 'en'
            },
            '_val' : {
                'child2' : 'children content',
                'child3' : 'children content'
            }
        }
    }
});

Output

<root><first>param1</first><child xmlns="http://com.example.webservice/" lang="en"><child2>children content</child2><child3>children content</child3></child></root>

License

This project is licensed under the MIT license.