{"_id":"xml","_rev":"113516","name":"xml","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"time":{"modified":"2021-06-03T10:46:08.000Z","created":"2011-04-11T03:37:08.770Z","1.0.1":"2016-01-31T01:33:20.949Z","1.0.0":"2014-09-26T22:30:23.340Z","0.0.12":"2014-01-28T15:29:16.819Z","0.0.10":"2013-11-08T16:36:29.273Z","0.0.9":"2013-11-08T14:03:50.843Z","0.0.8":"2013-09-15T21:48:38.304Z","0.0.7":"2011-10-28T19:18:14.498Z","0.0.5":"2011-05-08T23:57:24.247Z","0.0.4":"2011-04-13T03:56:36.490Z","0.0.3":"2011-04-11T03:55:29.103Z","0.0.2":"2011-04-11T03:37:08.770Z"},"users":{"dylang":true,"esperluette":true,"tudou":true,"victorzimmer":true,"dofy":true,"magemagic":true,"nachbar90":true,"oneinme":true,"luuhoangnam":true,"n0n1":true,"nfd":true,"smithjke":true,"and-":true,"jesusgoku":true,"stpettersens":true,"aahz":true,"cycomachead":true,"qqqppp9998":true,"karlbateman":true,"tfentonz":true,"antanst":true,"jybleau":true,"zuizuihao":true,"marcelitocs":true,"ahme-t":true,"rbecheras":true,"holly":true,"largepuma":true,"bpolonia":true,"mccoyjordan":true,"bradleybossard":true,"shanemileham":true,"rocket0191":true,"tsxuehu":true,"lynscott":true,"f2ostie":true,"nuwaio":true,"panlw":true,"xiaoyiyu":true},"author":{"name":"Dylan Greene","url":"https://github.com/dylang"},"repository":{"type":"git","url":"git+ssh://git@github.com/dylang/node-xml.git"},"versions":{"1.0.1":{"name":"xml","version":"1.0.1","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.","homepage":"http://github.com/dylang/node-xml","keywords":["xml","create","builder","json","simple"],"author":{"name":"Dylan Greene","url":"https://github.com/dylang"},"contributors":[{"name":"Dylan Greene","url":"https://github.com/dylang"},{"name":"Dodo","url":"https://github.com/dodo"},{"name":"Felix Geisendrfer","url":"felix@debuggable.com"},{"name":"Mithgol"},{"name":"carolineBda","url":"https://github.com/carolineBda"},{"name":"Eric Vantillard https://github.com/evantill"},{"name":"Sean Dwyer https://github.com/reywood"}],"repository":{"type":"git","url":"git+ssh://git@github.com/dylang/node-xml.git"},"bugs":{"url":"http://github.com/dylang/node-xml/issues"},"devDependencies":{"ava":"^0.11.0"},"scripts":{"test":"ava"},"main":"lib/xml.js","license":"MIT","gitHead":"c03b84bc1da9251f04db65428c8c341e51d0ff72","_id":"xml@1.0.1","_shasum":"78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5","_from":".","_npmVersion":"2.14.16","_nodeVersion":"4.2.1","_npmUser":{"name":"dylang","email":"dylang@gmail.com"},"dist":{"shasum":"78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5","size":6809,"noattachment":false,"key":"/xml/-/xml-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/xml/download/xml-1.0.1.tgz"},"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"directories":{},"publish_time":1454204000949,"_cnpm_publish_time":1454204000949,"_hasShrinkwrap":false},"1.0.0":{"name":"xml","version":"1.0.0","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.","homepage":"http://github.com/dylang/node-xml","keywords":["xml","create","builder","json","simple"],"author":{"name":"Dylan Greene","url":"https://github.com/dylang"},"contributors":[{"name":"Dylan Greene","url":"https://github.com/dylang"},{"name":"Dodo","url":"https://github.com/dodo"},{"name":"Felix Geisendrfer","url":"felix@debuggable.com"},{"name":"Mithgol"},{"name":"carolineBda","url":"https://github.com/carolineBda"},{"name":"Eric Vantillard https://github.com/evantill"},{"name":"Sean Dwyer https://github.com/reywood"}],"repository":{"type":"git","url":"http://github.com/dylang/node-xml"},"bugs":{"url":"http://github.com/dylang/node-xml/issues"},"devDependencies":{"chai":"~1.9.0","mocha":"~1.21.4"},"scripts":{"test":"mocha --reporter spec"},"main":"lib/xml.js","license":"MIT","gitHead":"e46f9ccb0f022a777f334e7bc5e5000f50660c2a","_id":"xml@1.0.0","_shasum":"de3ee912477be2f250b60f612f34a8c4da616efe","_from":".","_npmVersion":"2.1.0","_nodeVersion":"0.10.32","_npmUser":{"name":"dylang","email":"dylang@gmail.com"},"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"dist":{"shasum":"de3ee912477be2f250b60f612f34a8c4da616efe","size":6759,"noattachment":false,"key":"/xml/-/xml-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/xml/download/xml-1.0.0.tgz"},"directories":{},"publish_time":1411770623340,"_cnpm_publish_time":1411770623340,"_hasShrinkwrap":false},"0.0.12":{"name":"xml","version":"0.0.12","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.","homepage":"http://github.com/dylang/node-xml","keywords":["xml","create","builder","json","simple"],"author":{"name":"Dylan Greene","url":"https://github.com/dylang"},"contributors":[{"name":"Dylan Greene","url":"https://github.com/dylang"},{"name":"Dodo","url":"https://github.com/dodo"},{"name":"Felix Geisendrfer","url":"felix@debuggable.com"},{"name":"Mithgol"},{"name":"carolineBda","url":"https://github.com/carolineBda"},{"name":"Eric Vantillard https://github.com/evantill"}],"repository":{"type":"git","url":"http://github.com/dylang/node-xml"},"bugs":{"url":"http://github.com/dylang/node-xml/issues"},"devDependencies":{"chai":"~1.8.1","mocha":"~1.17.1"},"scripts":{"test":"mocha --reporter spec"},"main":"lib/xml.js","engines":{"node":">=0.4.0"},"licenses":[{"type":"MIT","url":"http://github.com/dylang/node-xml/raw/master/LICENSE"}],"_id":"xml@0.0.12","dist":{"shasum":"f08b347109912be00285785f46f15ad8e50a5f67","size":6788,"noattachment":false,"key":"/xml/-/xml-0.0.12.tgz","tarball":"http://registry.cnpm.dingdandao.com/xml/download/xml-0.0.12.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"dylang","email":"dylang@gmail.com"},"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"directories":{},"publish_time":1390922956819,"_hasShrinkwrap":false,"_cnpm_publish_time":1390922956819},"0.0.10":{"name":"xml","version":"0.0.10","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.","homepage":"http://github.com/dylang/node-xml","keywords":["xml","create","builder","json","simple"],"author":{"name":"Dylan Greene","url":"https://github.com/dylang"},"contributors":[{"name":"Dylan Greene","url":"https://github.com/dylang"},{"name":"Dodo","url":"https://github.com/dodo"},{"name":"Felix Geisendrfer","url":"felix@debuggable.com"},{"name":"Mithgol"},{"name":"carolineBda","url":"https://github.com/carolineBda"}],"repository":{"type":"git","url":"http://github.com/dylang/node-xml"},"bugs":{"url":"http://github.com/dylang/node-xml/issues"},"devDependencies":{"chai":"~1.7.2","mocha":"~1.12.0"},"scripts":{"test":"./node_modules/.bin/mocha --reporter spec"},"main":"lib/xml.js","engines":{"node":">=0.4.0"},"licenses":[{"type":"MIT","url":"http://github.com/dylang/node-xml/raw/master/LICENSE"}],"_id":"xml@0.0.10","dist":{"shasum":"2480d2c78a4c1a8533bc81f6b0e80f6a4a0f032f","size":6692,"noattachment":false,"key":"/xml/-/xml-0.0.10.tgz","tarball":"http://registry.cnpm.dingdandao.com/xml/download/xml-0.0.10.tgz"},"_from":".","_npmVersion":"1.3.13","_npmUser":{"name":"dylang","email":"dylang@gmail.com"},"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"directories":{},"publish_time":1383928589273,"_hasShrinkwrap":false,"_cnpm_publish_time":1383928589273},"0.0.9":{"name":"xml","version":"0.0.9","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.","homepage":"http://github.com/dylang/node-xml","keywords":["xml","create","builder","json","simple"],"author":{"name":"Dylan Greene","url":"https://github.com/dylang"},"contributors":[{"name":"Dylan Greene","url":"https://github.com/dylang"},{"name":"Dodo","url":"https://github.com/dodo"},{"name":"Felix Geisendrfer","url":"felix@debuggable.com"},{"name":"Mithgol"},{"name":"carolineBda","url":"https://github.com/carolineBda"}],"repository":{"type":"git","url":"http://github.com/dylang/node-xml"},"bugs":{"url":"http://github.com/dylang/node-xml/issues"},"devDependencies":{"chai":"~1.7.2","mocha":"~1.12.0"},"scripts":{"test":"./node_modules/.bin/mocha --reporter spec"},"main":"lib/xml.js","engines":{"node":">=0.4.0"},"licenses":[{"type":"MIT","url":"http://github.com/dylang/node-xml/raw/master/LICENSE"}],"_id":"xml@0.0.9","dist":{"shasum":"7ccc7334339d6e7eaea1013001e05abf46907028","size":6643,"noattachment":false,"key":"/xml/-/xml-0.0.9.tgz","tarball":"http://registry.cnpm.dingdandao.com/xml/download/xml-0.0.9.tgz"},"_from":".","_npmVersion":"1.3.13","_npmUser":{"name":"dylang","email":"dylang@gmail.com"},"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"directories":{},"publish_time":1383919430843,"_hasShrinkwrap":false,"_cnpm_publish_time":1383919430843},"0.0.8":{"name":"xml","version":"0.0.8","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.","homepage":"http://github.com/dylang/node-xml","keywords":["xml","create","builder","json","simple"],"author":{"name":"Dylan Greene","url":"https://github.com/dylang"},"contributors":[{"name":"Dylan Greene","url":"https://github.com/dylang"},{"name":"Dodo","url":"https://github.com/dodo"},{"name":"Felix Geisendrfer","url":"felix@debuggable.com"},{"name":"Mithgol"}],"repository":{"type":"git","url":"http://github.com/dylang/node-xml"},"bugs":{"url":"http://github.com/dylang/node-xml/issues"},"devDependencies":{"chai":"~1.7.2","mocha":"~1.12.0"},"scripts":{"test":"./node_modules/.bin/mocha --reporter spec"},"main":"lib/xml.js","engines":{"node":">=0.4.0"},"licenses":[{"type":"MIT","url":"http://github.com/dylang/node-xml/raw/master/LICENSE"}],"_id":"xml@0.0.8","dist":{"shasum":"e7970d9e085ddf53e52df49ead8dc34b6aff0503","size":12236,"noattachment":false,"key":"/xml/-/xml-0.0.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/xml/download/xml-0.0.8.tgz"},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"dylang","email":"dylang@gmail.com"},"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"directories":{},"publish_time":1379281718304,"_hasShrinkwrap":false,"_cnpm_publish_time":1379281718304},"0.0.7":{"name":"xml","version":"0.0.7","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.","homepage":"http://github.com/dylang/node-xml","keywords":["xml","create","builder"],"author":{"name":"Dylan Greene","url":"https://github.com/dylang"},"contributors":[{"name":"Dylan Greene","url":"https://github.com/dylang"},{"name":"Dodo","url":"https://github.com/dodo"},{"name":"Felix Geisendrfer","url":"felix@debuggable.com"}],"repository":{"type":"git","url":"git://github.com/dylang/node-xml.git"},"bugs":{"email":"dylang@gmail.com","url":"http://github.com/dylang/node-xml/issues"},"devDependencies":{"nodeunit":"*","logging":"*"},"scripts":{"test":"nodeunit test"},"main":"index.js","engines":{"node":">=0.4.0"},"licenses":[{"type":"MIT","url":"http://github.com/dylang/node-xml/raw/master/LICENSE"}],"_npmUser":{"name":"dylang","email":"dylang@gmail.com"},"_id":"xml@0.0.7","dependencies":{},"_engineSupported":true,"_npmVersion":"1.0.103","_nodeVersion":"v0.5.10","_defaultsLoaded":true,"dist":{"shasum":"1c07eab653658ab207369a905a463f2d3f605f8c","size":10240,"noattachment":false,"key":"/xml/-/xml-0.0.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/xml/download/xml-0.0.7.tgz"},"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"directories":{},"publish_time":1319829494498,"_hasShrinkwrap":false,"_cnpm_publish_time":1319829494498},"0.0.5":{"name":"xml","version":"0.0.5","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.","homepage":"http://github.com/dylang/node-xml","keywords":["xml","create","builder"],"author":{"name":"Dylan Greene","url":"https://github.com/dylang"},"contributors":[{"name":"Dylan Greene","url":"https://github.com/dylang"},{"name":"Dodo","url":"https://github.com/dodo"}],"repository":{"type":"git","url":"git://github.com/dylang/node-xml.git"},"bugs":{"email":"dylang@gmail.com","url":"http://github.com/dylang/node-xml/issues"},"devDependencies":{"nodeunit":"*","logging":"*"},"scripts":{"test":"nodeunit test"},"main":"index.js","engines":{"node":">=0.4.0"},"licenses":[{"type":"MIT","url":"http://github.com/dylang/node-xml/raw/master/LICENSE"}],"dependencies":{},"_id":"xml@0.0.5","_engineSupported":true,"_npmVersion":"1.0.3","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"cff2a56ec1dd5efc121de91b31f50c83816d0853","size":9506,"noattachment":false,"key":"/xml/-/xml-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/xml/download/xml-0.0.5.tgz"},"directories":{},"publish_time":1304899044247,"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"_hasShrinkwrap":false,"_cnpm_publish_time":1304899044247},"0.0.4":{"name":"xml","version":"0.0.4","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.","homepage":"http://github.com/dylang/node-xml","keywords":["xml","create","builder"],"author":{"name":"Dylan Greene","email":"dylang@gmail.com"},"contributors":[{"name":"Dylan Greene","email":"dylang@gmail.com"}],"repository":{"type":"git","url":"git://github.com/dylang/node-xml.git"},"bugs":{"email":"dylang@gmail.com","url":"http://github.com/dylang/node-xml/issues"},"dependencies":{"logging":">= 2.0.0"},"main":"index.js","engines":{"node":">=0.4.0"},"licenses":[{"type":"MIT","url":"http://github.com/dylang/node-xml/raw/master/LICENSE"}],"_id":"xml@0.0.4","_engineSupported":true,"_npmVersion":"0.3.18","_nodeVersion":"v0.4.2","directories":{"lib":"./lib"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"20f1e57d25d97577de1c7ece2db353185db66fa3","size":7886,"noattachment":false,"key":"/xml/-/xml-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/xml/download/xml-0.0.4.tgz"},"publish_time":1302666996490,"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"_hasShrinkwrap":false,"_cnpm_publish_time":1302666996490},"0.0.3":{"name":"xml","version":"0.0.3","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Tests and examples.","homepage":"http://github.com/dylang/node-xml","keywords":["xml","create","builder"],"author":{"name":"Dylan Greene","email":"dylang@gmail.com"},"contributors":[{"name":"Dylan Greene","email":"dylang@gmail.com"}],"repository":{"type":"git","url":"git://github.com/dylang/node-xml.git"},"bugs":{"email":"dylang@gmail.com","url":"http://github.com/dylang/node-xml/issues"},"dependencies":{"logging":">= 2.0.0"},"main":"index.js","engines":{"node":">=0.4.0"},"licenses":[{"type":"MIT","url":"http://github.com/dylang/node-xml/raw/master/LICENSE"}],"_id":"xml@0.0.3","_engineSupported":true,"_npmVersion":"0.3.18","_nodeVersion":"v0.4.2","directories":{"lib":"./lib"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"6655a81c2c036f6d263c4a4ef5494307b1e60c63","size":7538,"noattachment":false,"key":"/xml/-/xml-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/xml/download/xml-0.0.3.tgz"},"publish_time":1302494129103,"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"_hasShrinkwrap":false,"_cnpm_publish_time":1302494129103},"0.0.2":{"name":"xml","version":"0.0.2","description":"Fast and simple xml generator. Supports attributes, CDATA, etc. Tests and examples.","homepage":"http://github.com/dylang/node-xml","author":{"name":"Dylan Greene","email":"dylang@gmail.com"},"contributors":[{"name":"Dylan Greene","email":"dylang@gmail.com"}],"repository":{"type":"git","url":"git://github.com/dylang/node-xml.git"},"bugs":{"email":"dylang@gmail.com","url":"http://github.com/dylang/node-xml/issues"},"dependencies":{"logging":">= 2.0.0"},"main":"index.js","engines":{"node":">=0.4.0"},"licenses":[{"type":"MIT","url":"http://github.com/dylang/node-xml/raw/master/LICENSE"}],"_id":"xml@0.0.2","_engineSupported":true,"_npmVersion":"0.3.18","_nodeVersion":"v0.4.2","directories":{"lib":"./lib"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"54cb1b704beee9dbbc894ca486be45e6c3f20762","size":7490,"noattachment":false,"key":"/xml/-/xml-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/xml/download/xml-0.0.2.tgz"},"publish_time":1302493028770,"maintainers":[{"name":"dylang","email":""},{"name":"erisds","email":"erisds@gmail.com"}],"_hasShrinkwrap":false,"_cnpm_publish_time":1302493028770}},"readme":"# xml [![Build Status](https://api.travis-ci.org/dylang/node-xml.svg)](http://travis-ci.org/dylang/node-xml)\n\n[![NPM](https://nodei.co/npm/xml.png?downloads=true)](https://nodei.co/npm/xml/)\n\n> Fast and simple Javascript-based XML generator/builder for Node projects.\n\n## Install\n\n   $ npm install xml\n\n## API\n\n### `xml(xmlObject, options)`\n\nReturns a `XML` string.\n\n```js\nvar xml = require('xml');\nvar xmlString = xml(xmlObject, options);\n```\n\n#### `xmlObject`\n\n`xmlObject` is a normal JavaScript Object/JSON object that defines the data for the XML string.\n\nKeys will become tag names.\nValues can be an `array of xmlObjects` or a value such as a `string` or `number`.\n\n```js\nxml({a: 1}) === '<a>1</a>'\nxml({nested: [{ keys: [{ fun: 'hi' }]}]}) === '<nested><keys><fun>hi</fun></keys></nested>'\n```\n\nThere are two special keys:\n\n`_attr`\n\nSet attributes using a hash of key/value pairs.\n\n```js\nxml({a: [{ _attr: { attributes: 'are fun', too: '!' }}, 1]}) === '<a attributes=\"are fun\" too=\"!\">1</a>'\n````\n`_cdata`\n\nValue of `_cdata` is wrapped in xml `![CDATA[]]` so the data does not need to be escaped.\n\n```js\nxml({a: { _cdata: \"i'm not escaped: <xml>!\"}}) === '<a><![CDATA[i\\'m not escaped: <xml>!]]></a>'\n```\n\nMixed together:\n```js\nxml({a: { _attr: { attr:'hi'}, _cdata: \"I'm not escaped\" }}) === '<a attr=\"hi\"><![CDATA[I\\'m not escaped]]></a>'\n```\n\n#### `options`\n\n`indent` _optional_ **string** What to use as a tab. Defaults to no tabs (compressed).\n For example you can use `'\\t'` for tab character, or `'  '` for two-space tabs.\n\n`stream` Return the result as a `stream`.\n\n**Stream Example**\n\n```js\nvar elem = xml.element({ _attr: { decade: '80s', locale: 'US'} });\nvar stream = xml({ toys: elem }, { stream: true });\nstream.on('data', function (chunk) {console.log(\"data:\", chunk)});\nelem.push({ toy: 'Transformers' });\nelem.push({ toy: 'GI Joe' });\nelem.push({ toy: [{name:'He-man'}] });\nelem.close();\n\n/*\nresult:\ndata: <toys decade=\"80s\" locale=\"US\">\ndata:     <toy>Transformers</toy>\ndata:     <toy>GI Joe</toy>\ndata:     <toy>\n            <name>He-man</name>\n          </toy>\ndata: </toys>\n*/\n```\n\n`Declaration` _optional_ Add default xml declaration as first node.\n\n_options_ are:\n* encoding: 'value'\n* standalone: 'value'\n          \n**Declaration Example**\n\n```js\nxml([ { a: 'test' }], { declaration: true })\n//result: '<?xml version=\"1.0\" encoding=\"UTF-8\"?><a>test</a>'\n\nxml([ { a: 'test' }], { declaration: { standalone: 'yes', encoding: 'UTF-16' }})\n//result: '<?xml version=\"1.0\" encoding=\"UTF-16\" standalone=\"yes\"?><a>test</a>'\n```\n\n## Examples\n\n**Simple Example**\n\n```js\nvar example1 = [ { url: 'http://www.google.com/search?aq=f&sourceid=chrome&ie=UTF-8&q=opower' } ];\nconsole.log(XML(example1));\n//<url>http://www.google.com/search?aq=f&amp;sourceid=chrome&amp;ie=UTF-8&amp;q=opower</url>\n```\n\n**Example with attributes**\n\n```js\nvar example2 = [ { url: { _attr: { hostname: 'www.google.com', path: '/search?aq=f&sourceid=chrome&ie=UTF-8&q=opower' }  } } ];\nconsole.log(XML(example2));\n//result: <url hostname=\"www.google.com\" path=\"/search?aq=f&amp;sourceid=chrome&amp;ie=UTF-8&amp;q=opower\"/>\n```\n\n**Example with array of same-named elements and nice formatting**\n\n```js\nvar example3 = [ { toys: [ { toy: 'Transformers' } , { toy: 'GI Joe' }, { toy: 'He-man' } ] } ];\nconsole.log(XML(example3));\n//result: <toys><toy>Transformers</toy><toy>GI Joe</toy><toy>He-man</toy></toys>\nconsole.log(XML(example3, true));\n/*\nresult:\n<toys>\n    <toy>Transformers</toy>\n    <toy>GI Joe</toy>\n    <toy>He-man</toy>\n</toys>\n*/\n```\n\n**More complex example**\n\n```js\nvar example4 = [ { toys: [ { _attr: { decade: '80s', locale: 'US'} }, { toy: 'Transformers' } , { toy: 'GI Joe' }, { toy: 'He-man' } ] } ];\nconsole.log(XML(example4, true));\n/*\nresult:\n<toys decade=\"80s\" locale=\"US\">\n    <toy>Transformers</toy>\n    <toy>GI Joe</toy>\n    <toy>He-man</toy>\n</toys>\n*/\n```\n\n**Even more complex example**\n\n```js\nvar example5 = [ { toys: [ { _attr: { decade: '80s', locale: 'US'} }, { toy: 'Transformers' } , { toy: [ { _attr: { knowing: 'half the battle' } }, 'GI Joe'] }, { toy: [ { name: 'He-man' }, { description: { _cdata: '<strong>Master of the Universe!</strong>'} } ] } ] } ];\nconsole.log(XML(example5, true));\n/*\nresult:\n<toys decade=\"80s\" locale=\"US\">\n    <toy>Transformers</toy>\n    <toy knowing=\"half the battle\">\n        GI Joe\n    </toy>\n    <toy>\n        <name>He-man</name>\n        <description><![CDATA[<strong>Master of the Universe!</strong>]]></description>\n    </toy>\n</toys>\n*/\n```\n\n## Tests\n\nTests included use [AVA](https://ava.li). Use `npm test` to run the tests.\n\n    $ npm test\n\n## Examples\n\nThere are examples in the examples directory.\n\n# Contributing\n\nContributions to the project are welcome. Feel free to fork and improve. I accept pull requests when tests are included.\n","_attachments":{},"homepage":"http://github.com/dylang/node-xml","bugs":{"url":"http://github.com/dylang/node-xml/issues"},"license":"MIT"}