{
  "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": "./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"
    }
  ],
  "readme": "# XML for Node [![Build Status](https://secure.travis-ci.org/dylang/node-xml.png)](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 Mocha. 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 and issues,\nespecially when tests are included.\n\n# License\n\n(The MIT License)\n\nCopyright (c) 2011-2013 Dylan Greene <dylang@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
  "readmeFilename": "readme.md",
  "_id": "xml@0.0.12",
  "dist": {
    "shasum": "521a156490860d1353d069c0264449b77830b49b"
  },
  "_from": "xml@~0.0.12",
  "_resolved": "https://registry.npmjs.org/xml/-/xml-0.0.12.tgz"
}
