{"name":"xml-writer","version":"1.0.2","description":"Native and full Javascript implementation of the classic XMLWriter class","homepage":"http://github.com/touv/node-xml-writer","main":"./index.js","scripts":{"test":"nodeunit"},"devDependencies":{"nodeunit":">=0.6.2"},"repository":{"type":"git","url":"git://github.com/touv/node-xml-writer.git"},"keywords":["xml","writer","XMLWriter","generator"],"author":{"name":"Nicolas Thouvenin","email":"nthouvenin@gmail.com","url":"http://blog.touv.fr"},"license":"MIT/X11","engine":{"node":">=0.4"},"_npmUser":{"name":"touv","email":"nthouvenin@gmail.com"},"_id":"xml-writer@1.0.2","dependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.2","_defaultsLoaded":true,"dist":{"shasum":"640282701b428b29c19a036976963f2eec7dfb21","tarball":"http://registry-npm.ywwl.com/xml-writer/download/xml-writer-1.0.2.tgz","integrity":"sha512-l14rmn3E0NI8F/WqiPHqirGAhcbdv46PnjIWGeYzjSx6wCDKlnsWQQouC+wfFP+njQHe2mDPxkyblHyJmYUAKQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHNkRHkddSmQrHxeppQwQ+f8QuXi42h3hZv/3Br31Z5AAiAVr4b1zwV+mBmX10t64KRCNJbqT0CootqY80vyDLqzzQ=="}],"size":4933,"noattachment":false,"key":"/xml-writer/-/xml-writer-1.0.2.tgz"},"maintainers":[{"name":"touv","email":"nthouvenin@gmail.com"}],"directories":{},"readme":"# XMLWriter for NodeJS\n\n[![Build Status](https://secure.travis-ci.org/touv/node-xml-writer.png?branch=master)](http://travis-ci.org/touv/node-xml-writer)\n\nIt's native and full javascript implementation of the classic XMLWriter class.\nThe API is complete, flexible and tolerant.\nXML is still valid.\n\n## Contributors\n\n  * [Nicolas Thouvenin](https://github.com/touv)\n  * [Anton Zem](https://github.com/AlgoTrader)\n  * [Chip Lee](https://github.com/chipincode)\n  * [Peecky](https://github.com/peecky)\n  * [Julian Scheid](https://github.com/jscheid)\n  * [Guillaume Plique](https://github.com/Yomguithereal)\n\n# Installation\n\nWith [npm](http://npmjs.org) do:\n\n    $ npm install xml-writer\n\n\n# Examples\n\n## Basic\n```javascript\n\tvar XMLWriter = require('xml-writer');\n\txw = new XMLWriter;\n\txw.startDocument();\n\txw.startElement('root');\n\txw.writeAttribute('foo', 'value');\n\txw.text('Some content');\n\txw.endDocument();\n\n\tconsole.log(xw.toString());\n```\nOutput:\n\n\t<?xml version=\"1.0\"?>\n\t<root foo=\"value\">Some content</root>\n\nTip: If you want your XML **indented** use `new XMLWriter(true)` or `new XMLWriter('\\t')`, for instance, if you want to use a custom string for indentation.\n\n## Chaining\n```javascript\n\tvar XMLWriter = require('xml-writer');\n\txw = new XMLWriter;\n\txw.startDocument().startElement('root').writeAttribute('foo', 'value').writeElement('tag', 'Some content');\n\n\tconsole.log(xw.toString());\n```\nOutput:\n\n\t<?xml version=\"1.0\"?>\n\t<root foo=\"value\"><tag>Some content</tag></root>\n\n## Tolerant\n```javascript\n\tvar XMLWriter = require('xml-writer');\n\txw = new XMLWriter;\n\txw.startElement('root').writeAttribute('foo', 'value').text('Some content');\n\n\tconsole.log(xw.toString());\n```\nOutput:\n\n\t<root foo=\"value\">Some content</root>\n\n\n## Extensible\n```javascript\n\tvar XMLWriter = require('xml-writer'),\n               fs = require('fs');\n\tvar ws = fs.createWriteStream('/tmp/foo.xml');\n\tws.on('close', function() {\n\t\t\tconsole.log(fs.readFileSync('/tmp/foo.xml', 'UTF-8'));\n\t});\n\txw = new XMLWriter(false, function(string, encoding) {\n\t\t\tws.write(string, encoding);\n\t});\n\txw.startDocument('1.0', 'UTF-8').startElement(function() {\n\t\treturn 'root';\n\t}).text(function() {\n\t\treturn 'Some content';\n\t});\n\tws.end();\n```\n\nOutput:\n\n\t<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\t<root>Some content</root>\n\n\n# Tests\n\nUse [nodeunit](https://github.com/caolan/nodeunit) to run the tests.\n\n    $ npm install nodeunit\n    $ nodeunit test\n\n# API Documentation\n\n## Generic\n\n### constructor XMLWriter(Boolean|String indent, Function writer(string, encoding))\nCreate an new writer\n\n### text(String content)\nWrite text\n\n### writeRaw\nWrite a raw XML text\n\n## Document\n### startDocument(String version = '1.0', String encoding = NULL, Boolean standalone = false)\nCreate document tag\n\n### endDocument()\nEnd current document\n\n## Element\n\n### writeElement(String name, String content)\nWrite full element tag\n\n### writeElementNS\nWrite full namespaced element tag\n\n### startElementNS\nCreate start namespaced element tag\n\n### startElement(String name)\nCreate start element tag\n\n### endElement()\nEnd current element\n\n## Attributes\n\n### writeAttribute(String name, String value)\nWrite full attribute\n\n### writeAttributeNS\nWrite full namespaced attribute\n\n### startAttributeNS\nCreate start namespaced attribute\n\n### startAttribute(String name)\nCreate start attribute\n\n### endAttribute()\nEnd attribute\n\n## Processing Instruction\n\n### writePI(String name, String content)\nWrites a PI\n\n### startPI(String name)\nCreate start PI tag\n\n### endPI()\nEnd current PI\n\n## DocType\n\n### writeDocType(String name, String pubid, String sysid, String subset)\nWrite a DocType\n\n### startDocType(String name, String pubid, String sysid, String subset)\nCreate start DocType tag\n\n### endDocType()\nEnd current DocType\n\n## CData\n\n### writeCData(String content)\nWrite full CDATA tag\n\n### startCData()\nCreate start CDATA tag\n\n### endCData()\nEnd current CDATA\n\n## Comment\n\n### writeComment(String content)\nWrite full comment tag\n\n### startComment()\nCreate start comment\n\n### endComment()\nCreate end comment\n\n# Also\n\n* https://github.com/minchenkov/simple-xml-writer\n* https://github.com/wezm/node-genx\n\n# License\n\n[MIT/X11](./LICENSE)\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/touv/node-xml-writer/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","publish_time":1322131914102,"_cnpm_publish_time":1322131914102,"dist-tags":{"latest":"1.7.0"}}