{"name":"xmlbuilder","version":"0.0.1","description":"An XML builder for node.js","author":{"name":"Ozgur Ozcitak","email":"oozcitak@gmail.com"},"licenses":[{"type":"MIT","url":"http://opensource.org/licenses/mit-license.php"}],"repositories":[{"type":"git","url":"git://github.com/oozcitak/xmlbuilder-js.git"}],"bugs":{"web":"http://github.com/oozcitak/xmlbuilder-js/issues"},"directories":{"lib":"./lib"},"dependencies":{},"_id":"xmlbuilder@0.0.1","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry-npm.ywwl.com/xmlbuilder/download/xmlbuilder-0.0.1.tgz","shasum":"6829a52dcd19245bde1b1daa790c9ee8e859e0de","integrity":"sha512-CMTVKEk7fCWMliR46oqC7PSuA4r/ywhnTUAdDvuF4scXis3F5iTBIrLaSoOYKAMTWFlruBjfBCNSnnyHh3O6+w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGAjAbDwrHs3l+7DELxWIddBsdvuJaQqmI3pmR2oRwt8AiEAtTTnsANPrVCAo9ZzSxMvtukE3ruwq5qJ3IbECgGDGLY="}],"size":5175,"noattachment":false,"key":"/xmlbuilder/-/xmlbuilder-0.0.1.tgz"},"readme":"# xmlbuilder-js\r\n\r\nAn XML builder for [node.js](https://nodejs.org/) similar to\r\n[java-xmlbuilder](https://github.com/jmurty/java-xmlbuilder).\r\n\r\n[![License](http://img.shields.io/npm/l/xmlbuilder.svg?style=flat-square)](http://opensource.org/licenses/MIT)\r\n[![NPM Version](http://img.shields.io/npm/v/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder)\r\n[![NPM Downloads](https://img.shields.io/npm/dm/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder)\r\n\r\n[![Travis Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js)\r\n[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/bf7odb20hj77isry?svg=true)](https://ci.appveyor.com/project/oozcitak/xmlbuilder-js)\r\n[![Dev Dependency Status](http://img.shields.io/david/dev/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)\r\n[![Code Coverage](https://img.shields.io/coveralls/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://coveralls.io/github/oozcitak/xmlbuilder-js)\r\n\r\n### Announcing `xmlbuilder2`:\r\n\r\nThe new release of `xmlbuilder` is available at [`xmlbuilder2`](https://github.com/oozcitak/xmlbuilder2)! `xmlbuilder2` has been redesigned from the ground up to be fully conforming to the [modern DOM specification](https://dom.spec.whatwg.org). It supports XML namespaces, provides built-in converters for multiple formats, collection functions, and more. Please see [upgrading from xmlbuilder](https://oozcitak.github.io/xmlbuilder2/upgrading-from-xmlbuilder.html) in the wiki.\r\n\r\nNew development will be focused towards `xmlbuilder2`; `xmlbuilder` will only receive critical bug fixes.\r\n\r\n### Installation:\r\n\r\n``` sh\r\nnpm install xmlbuilder\r\n```\r\n\r\n### Usage:\r\n\r\n``` js\r\nvar builder = require('xmlbuilder');\r\n\r\nvar xml = builder.create('root')\r\n  .ele('xmlbuilder')\r\n    .ele('repo', {'type': 'git'}, 'git://github.com/oozcitak/xmlbuilder-js.git')\r\n  .end({ pretty: true});\r\n\r\nconsole.log(xml);\r\n```\r\n\r\nwill result in:\r\n\r\n``` xml\r\n<?xml version=\"1.0\"?>\r\n<root>\r\n  <xmlbuilder>\r\n    <repo type=\"git\">git://github.com/oozcitak/xmlbuilder-js.git</repo>\r\n  </xmlbuilder>\r\n</root>\r\n```\r\n\r\nIt is also possible to convert objects into nodes:\r\n\r\n``` js\r\nvar builder = require('xmlbuilder');\r\n\r\nvar obj = {\r\n  root: {\r\n    xmlbuilder: {\r\n      repo: {\r\n        '@type': 'git', // attributes start with @\r\n        '#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // text node\r\n      }\r\n    }\r\n  }\r\n};\r\n\r\nvar xml = builder.create(obj).end({ pretty: true});\r\nconsole.log(xml);\r\n```\r\n\r\nIf you need to do some processing:\r\n\r\n``` js\r\nvar builder = require('xmlbuilder');\r\n\r\nvar root = builder.create('squares');\r\nroot.com('f(x) = x^2');\r\nfor(var i = 1; i <= 5; i++)\r\n{\r\n  var item = root.ele('data');\r\n  item.att('x', i);\r\n  item.att('y', i * i);\r\n}\r\n\r\nvar xml = root.end({ pretty: true});\r\nconsole.log(xml);\r\n```\r\n\r\nThis will result in:\r\n\r\n``` xml\r\n<?xml version=\"1.0\"?>\r\n<squares>\r\n  <!-- f(x) = x^2 -->\r\n  <data x=\"1\" y=\"1\"/>\r\n  <data x=\"2\" y=\"4\"/>\r\n  <data x=\"3\" y=\"9\"/>\r\n  <data x=\"4\" y=\"16\"/>\r\n  <data x=\"5\" y=\"25\"/>\r\n</squares>\r\n```\r\n\r\nSee the [wiki](https://github.com/oozcitak/xmlbuilder-js/wiki) for details and [examples](https://github.com/oozcitak/xmlbuilder-js/wiki/Examples) for more complex examples.\r\n","publish_time":1293543899957,"maintainers":[{"name":"oozcitak","email":"oozcitak@gmail.com"}],"_cnpm_publish_time":1293543899957,"dist-tags":{"latest":"15.1.1"}}