{"_id":"@kyleshockey/xml","_rev":"2-7bf7a133a3cad1a8a81055f7eb5ebc3e","name":"@kyleshockey/xml","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.1":{"name":"@kyleshockey/xml","version":"1.0.1","description":"Fast and simple isomorphic 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/shockey/node-xml.git"},"bugs":{"url":"http://github.com/shockey/node-xml/issues"},"dependencies":{"stream":"^0.0.2"},"devDependencies":{"ava":"^0.11.0"},"scripts":{"test":"ava"},"main":"lib/xml.js","license":"MIT","gitHead":"ce328836c8bcec771297ed2550fff4722c1e8757","_id":"@kyleshockey/xml@1.0.1","_npmVersion":"6.1.0","_nodeVersion":"8.11.2","_npmUser":{"name":"kyleshockey","email":"kyle.shockey1@gmail.com"},"dist":{"integrity":"sha512-52x8JUtzElWEP+LClQfq/KqlI4yMOmfJ8qcvkB3N7I8ElD3M8jazuu1gXdpzz3a+FW9b92m+A08e7Soe5GmPKw==","shasum":"0a2c5f9b29d75a5e0d8cb776de73d390d022d731","tarball":"https://registry.npmjs.org/@kyleshockey/xml/-/xml-1.0.1.tgz","fileCount":9,"unpackedSize":23934,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb2ioOCRA9TVsSAnZWagAAFsgP/Az1MZDoPuWC3x+BP7gG\nM59zSyp3cNMg+bmxXDQOZgPTGACBHAGAQQaPywpKdrCdnVH0BH1T8pzrlATm\n7fbyWtDyQTPn0ppvaJd2zTz/kwI4uoMx73aoALIHd65eVgRCL1hm8gV7LsSp\nlNwe2lToBwCDkJFPUOqfP+clsB0TFrQD5VTo8PKHs00OepLuMemwPmFoiHN5\nOYUfzHguzmrzoA2pzVjsMAhmIXAFqnkFDJGcekuGDbsOOkjGrvTguqSpdsXt\n5bB0P2lA4b/tILoA3gFGeBO9JP1jq7weJeN84+M1WF0J1f/TetsA4pBMnULo\nhkN2LMNPCkUajsp/b4/uxOHUHfN+qYahGYzSiUKbyuJ45FHBVZrHAWwE8rn2\npDSZb2qKSbWmS1jOUwatGFeJC7yyDkYxS67g12uHdJLHLm8oz2XzPa9pyMCe\n40z53A94Uc8MFefJ9SRRHbvT9Q1xiFQC4rOdGprlO/tXXBYpveoxTkjmyMkD\nFaKQ0cCNZGQKo76sGo36m6+ZUddCZDuS7IOxtFpTR0bgO0AWokidX1IyPaA4\ndAPBN704zZaJtnEYJJhHpB30pweRo16AgLh3VVg8J3Lt3W1AzxXOSSZvQF3o\nGP1IB7/9epHHBV4jsmkI+SPfJil8btJ3Le4BCBtg6cU4Qc0mTGRdmDDDGO2W\nxzH1\r\n=bSAi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEqUgFHrlbxd/sB5QKANlfxIp4TOVaLbW689AyKx6xaLAiEA9zwsHIlttYnzxmPkExwGVZ/FcX08IHIPkt+G4RyWlQg="}]},"maintainers":[{"name":"kyleshockey","email":"kyle.shockey1@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xml_1.0.1_1541024269656_0.17811722534708174"},"_hasShrinkwrap":false},"1.0.2":{"name":"@kyleshockey/xml","version":"1.0.2","description":"Fast and simple isomorphic 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/shockey/node-xml.git"},"bugs":{"url":"http://github.com/shockey/node-xml/issues"},"dependencies":{"stream":"^0.0.2"},"devDependencies":{"ava":"^0.11.0"},"scripts":{"test":"ava"},"main":"lib/xml.js","license":"MIT","gitHead":"cd5837bcbb8f7d98638b39bd03853c06962c71eb","_id":"@kyleshockey/xml@1.0.2","_npmVersion":"6.1.0","_nodeVersion":"8.11.2","_npmUser":{"name":"kyleshockey","email":"kyle.shockey1@gmail.com"},"dist":{"integrity":"sha512-iMo32MPLcI9cPxs3YL5kmKxKgDmkSZDCFEqIT5eRk7d/Ll8r4X3SwGYSigzALd6+RHWlFEmjL1QyaQ15xDZFlw==","shasum":"81fad3d7c33da2ba2639db095db3db24c2921f70","tarball":"https://registry.npmjs.org/@kyleshockey/xml/-/xml-1.0.2.tgz","fileCount":5,"unpackedSize":15077,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb2iqDCRA9TVsSAnZWagAArrMP/23ZFkwuM44udy6jgs/Y\n1OmnXAa/qxNlc6wrOWK5d6+j46kM4c1RXyP31JI/qMEH3lr4hCLHQ91JGjy4\ndSUcUI07KE2alatXldSOEo3fC8ACXMoDytlXQ1NazT94V9wHEDFNuBXgxich\nz/XpE2FQpcgymOmTyxRf6mH+i55PeF8ZeM4Lj38AtXTXNXQ4Apu4HEzn4xmF\nWB8aHg1Viv/HPcSBPMepgVqPMktlSOCi6VkPyuAu9M0dnmbMIMAuCkPqdO2G\n8PYDh06KjYKQOI3MT7ULPtbzKxnxj+EKwrsGp6LwBRHJyZQQO7Qglliw5x38\nUq1yvl4F32RmrzB7Uh8DIkFPBf0M3zWQ+CqGi9lPqeP+k/kReg7nyDSXyahK\n5hSbt8HHYi4u+/QkmQX9gUskatG09fMcmfbdAutD26mpgf04/GWeRVhzUkKh\nU6/+28h+spd1z1S5OXYpN1o06/uCbZ8iNXBMpC2wFbd7UyrVxiTn0KqS3DG6\nrU8eDSUE8wmyDTE0catQMEQ+3gCkV37+FaFqsaBRmO/vnujxnmrbZjWo5uZP\n6j6Yw2hxHSkVe2BzkGENVjGkovtD07+Cwx0srdxHLQP52KLgK1xV3vQ6pF4G\nKKTH6QfQff8mRhYqqDg4R/gkQXO8xEh/robLkjrrPAOtOsivhJ9BoZTePLKa\n2iG9\r\n=MU0x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDj2NlXw4bIOp2yC/RzpwPRJzf1TI3aAKo1DeDit9rhawIgb6ni8Wk9gKDxf5vuohzGHny08clU1ACowh50xuAK3/8="}]},"maintainers":[{"name":"kyleshockey","email":"kyle.shockey1@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xml_1.0.2_1541024387384_0.637032893205949"},"_hasShrinkwrap":false}},"time":{"created":"2018-10-31T22:17:49.497Z","1.0.1":"2018-10-31T22:17:49.810Z","modified":"2022-04-06T00:32:20.747Z","1.0.2":"2018-10-31T22:19:47.530Z"},"maintainers":[{"name":"kyleshockey","email":"kyle.shockey1@gmail.com"}],"description":"Fast and simple isomorphic xml generator. Supports attributes, CDATA, etc. Includes tests and examples.","homepage":"http://github.com/dylang/node-xml","keywords":["xml","create","builder","json","simple"],"repository":{"type":"git","url":"git+ssh://git@github.com/shockey/node-xml.git"},"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"}],"author":{"name":"Dylan Greene","url":"https://github.com/dylang"},"bugs":{"url":"http://github.com/shockey/node-xml/issues"},"license":"MIT","readme":"This is a fork of `xml` that supports usage in browsers, without the need for a module loader/bundler that supports shimming built-in Node.js modules.\n\nThis is made possible by listing [`stream`](https://www.npmjs.com/package/stream) as a dependency in the package manifest. Since Node.js [prioritizes its own built-in modules](https://nodejs.org/api/modules.html#modules_core_modules) over third-party modules of the same name, Node.js continues to use the built-in implementation, while a browser context also gets the `stream` module that it needs.\n\n---\n\n# xml\n\n[![NPM](https://nodei.co/npm/@kyleshockey/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 @kyleshockey/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","readmeFilename":"readme.md"}