{"name":"xml-writer","version":"1.2.4","author":{"name":"Nicolas Thouvenin","email":"nthouvenin@gmail.com"},"contributors":[{"name":"Anton Zem"}],"description":"Native and full Javascript implementation of the classic XMLWriter class","keywords":["xml","writer","XMLWriter","generator"],"homepage":"http://github.com/touv/node-xml-writer","scripts":{"test":"nodeunit test/"},"main":"./index.js","repository":{"type":"git","url":"https://github.com/touv/node-xml-writer.git"},"dependencies":{},"devDependencies":{"nodeunit":">=0.7.3"},"license":"MIT","engines":{"node":">=0.4.0"},"_id":"xml-writer@1.2.4","dist":{"shasum":"7153a379c79a171b9259a781d92a5d1058fd6cbd","tarball":"http://registry-npm.ywwl.com/xml-writer/download/xml-writer-1.2.4.tgz","integrity":"sha512-IY4QkOk4LO72vhjvkvR7+u9AtWOUGRTuSNHdZXFiFagYQLS/aQJPXgAKzNF5J5+T26/WbyLcF63ebJYDsYoeyA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCS0ubNWEWvbXQ3w4Xt5i04l0FVghGk+SXyE3uuVpQVHgIhAIIfdY4j9/Dc33SwPuLJsQ1HcwSTNOkxcFzRRwTzjm7W"}],"size":5986,"noattachment":false,"key":"/xml-writer/-/xml-writer-1.2.4.tgz"},"_npmVersion":"1.2.0","_npmUser":{"name":"touv","email":"nthouvenin@gmail.com"},"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":1360271643845,"_cnpm_publish_time":1360271643845,"dist-tags":{"latest":"1.7.0"}}