{"name":"xmlbuilder","version":"3.1.0","keywords":["xml","xmlbuilder"],"homepage":"http://github.com/oozcitak/xmlbuilder-js","description":"An XML builder for node.js","author":{"name":"Ozgur Ozcitak","email":"oozcitak@gmail.com"},"contributors":[],"license":"MIT","repository":{"type":"git","url":"git://github.com/oozcitak/xmlbuilder-js.git"},"bugs":{"url":"http://github.com/oozcitak/xmlbuilder-js/issues"},"main":"./lib/index","engines":{"node":">=0.8.0"},"dependencies":{"lodash":"^3.5.0"},"devDependencies":{"coffee-script":"*","mocha":"*"},"scripts":{"prepublish":"coffee -co lib src","postpublish":"rm -rf lib","test":"mocha --ui tdd --reporter dot --compilers coffee:coffee-script/register --require test/common/common"},"readme":"# xmlbuilder-js\n\nAn XML builder for [io.js](https://iojs.org/) similar to \n[java-xmlbuilder](https://github.com/jmurty/java-xmlbuilder).\n\n[![NPM Version](http://img.shields.io/npm/v/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder)\n[![License](http://img.shields.io/npm/l/xmlbuilder.svg?style=flat-square)](http://opensource.org/licenses/MIT)\n[![Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js)\n[![Dependency Status](http://img.shields.io/david/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)\n[![Dev Dependency Status](http://img.shields.io/david/dev/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)\n\n### Installation:\n\n``` sh\nnpm install xmlbuilder\n```\n\n### Usage:\n\n``` js\nvar builder = require('xmlbuilder');\nvar xml = builder.create('root')\n  .ele('xmlbuilder', {'for': 'node-js'})\n    .ele('repo', {'type': 'git'}, 'git://github.com/oozcitak/xmlbuilder-js.git')\n  .end({ pretty: true});\n    \nconsole.log(xml);\n```\n\nwill result in:\n\n``` xml\n<?xml version=\"1.0\"?>\n<root>\n  <xmlbuilder for=\"node-js\">\n    <repo type=\"git\">git://github.com/oozcitak/xmlbuilder-js.git</repo>\n  </xmlbuilder>\n</root>\n```\n\nIt is also possible to convert objects into nodes:\n\n``` js\nbuilder.create({\n  root: {\n    xmlbuilder: {\n      '@for': 'node-js', // attributes start with @\n      repo: {\n        '@type': 'git',\n        '#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // text node\n      }\n    }\n  }\n});\n```\n\nIf you need to do some processing:\n\n``` js\nvar root = builder.create('squares');\nroot.com('f(x) = x^2');\nfor(var i = 1; i <= 5; i++)\n{\n  var item = root.ele('data');\n  item.att('x', i);\n  item.att('y', i * i);\n}\n```\n\nThis will result in:\n\n``` xml\n<?xml version=\"1.0\"?>\n<squares>\n  <!-- f(x) = x^2 -->\n  <data x=\"1\" y=\"1\"/>\n  <data x=\"2\" y=\"4\"/>\n  <data x=\"3\" y=\"9\"/>\n  <data x=\"4\" y=\"16\"/>\n  <data x=\"5\" y=\"25\"/>\n</squares>\n```\n\nSee the [wiki](https://github.com/oozcitak/xmlbuilder-js/wiki) for details.\n","readmeFilename":"README.md","_id":"xmlbuilder@3.1.0","_shasum":"2c86888f2d4eade850fa38ca7f7223f7209516e1","_from":"https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-3.1.0.tgz","_resolved":"https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-3.1.0.tgz"}