{"name":"xml-mapping","version":"1.4.0","author":{"name":"Nicolas Thouvenin","email":"nthouvenin@gmail.com"},"contributors":[{"name":"Joe Ibershoff","email":"joe@ibershoff.com","url":"https://github.com/zacronos"},{"name":"Yura Zenevich","email":"yura.zenevich@gmail.com","url":"https://github.com/yzen"},{"name":"Thorsten Lorenz","email":"thlorenz@gmx.de","url":"https://github.com/thlorenz"},{"name":"ntgn81","email":"ntgn81@gmail.com","url":"https://github.com/ntgn81"}],"description":"provide a bidirectionnal mapping between XML and JS data Structure (aka JSON)","keywords":["xml","json","json2xml","xml2json"],"homepage":"http://github.com/touv/node-xml-mapping","scripts":{"test":"nodeunit test/"},"main":"./xml-mapping.js","repository":{"type":"git","url":"https://github.com/touv/node-xml-mapping.git"},"dependencies":{"xml-writer":">=1.0.4","sax":"=0.4.2"},"devDependencies":{"nodeunit":">=0.7.3"},"license":"MIT","engines":{"node":">=0.2.0"},"bugs":{"url":"https://github.com/touv/node-xml-mapping/issues"},"_id":"xml-mapping@1.4.0","dist":{"shasum":"5e9f5aeb422211a7142578b50069491cc49ea450","tarball":"http://registry-npm.ywwl.com/xml-mapping/download/xml-mapping-1.4.0.tgz","integrity":"sha512-t6SiX44a6yvfNNE2uVsyLXRPqsjs+7hEvmfNSjulN+T+5Q3MY8dN5lGQB+2j6K1xvIyWUjZ1eVeO4Njj3ca7aQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhVA4LZhJF+r7hZfn/6XATf8Oo+j33Mla4tUWSH4KAaAIhALvLACwUrGRbOIvCjfwiFRdTM8uZgcbwfPs8OXXJ24X+"}],"size":10534,"noattachment":false,"key":"/xml-mapping/-/xml-mapping-1.4.0.tgz"},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"touv","email":"nthouvenin@gmail.com"},"maintainers":[{"name":"touv","email":"nthouvenin@gmail.com"}],"directories":{},"readme":"# xml2json and json2xml for NodeJS\n\n[![Build Status](https://secure.travis-ci.org/Inist-CNRS/node-xml-mapping.png?branch=master)](http://travis-ci.org/Inist-CNRS/node-xml-mapping)\n\nIt's native javascript implementation of a bidirectional converter between XML and JS data structure (aka JSON).\nYou can convert any type of XML documents in an Javascript data structure.\nYou can also do the reverse, converting a Javascript data structure in XML String. XML is still valid.\n\n## Contributors\n\n  * [Nicolas Thouvenin](https://github.com/touv)\n  * [Joe Ibershoff](https://github.com/zacronos)\n  * [Yura Zenevich](https://github.com/yzen)\n  * [Thorsten Lorenz](https://github.com/thlorenz)\n  * [ntgn81](https://github.com/ntgn81)\n  * [Rowell Cruz](https://github.com/rcruz)\n  * [JT](https://github.com/spikyjt)\n  * [Bindu Wavell](https://github.com/binduwavell)\n  * [niederlec](https://github.com/niederlec)\n\n# Installation\n\nWith [npm](http://npmjs.org) do:\n\n    $ npm install xml-mapping\n\n\n# Usage\n```javascript\nvar XMLMapping = require('xml-mapping');\n\nvar json = XMLMapping.load('<key>value</key>');\nvar xml  = XMLMapping.dump(json);\n\nconsole.log(xml,json);\nconsole.log(json);\n```\n\nOutput:\n\n    <key>value</key> { key: { '$t': 'value' } }\n\n# Convention\n\nThe rules for converting XML to JSON are those used by Google in its GData protocol. More information here : http://code.google.com/apis/gdata/docs/json.html\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## load(String xml, Object options)\nTransform a string with XML in Javascript data structure (JSON).\n**Return Object.**\n\n###Options\n\n**Warning : options break the symmetry. This means that the JSON generated may not reproduce the same XML**\n\n* `throwErrors` - *boolean* - Flag to throw errors of the SAX Parser ; *default : false*\n* `nested` - *boolean* - Flag to ignore nested tags inside text : *default : false*\n* `specialChar` - *string* - Set the first character of XML tag ($t, $text, $cd, $cdata, $e, $element, $c, $comment); *default : $*\n* `longTag` - *boolean* - Use long names tags($text, $element, $cdata, $comment) rather than short names ($t, $cd, $e, $c); *default : false*\n* `comments` - *boolean* - Flag to ignore comments, if false all the comments will be ignored : *default : true*\n* `parserInfos` - *boolean* - Flag to add some attributes generated by the parser (order, line, column, name), if true informations are inserted in the attributes list of all tags : *default : false*\n\n```javascript\nvar xml = '<title>Title is <strong>important</strong></title>';\nvar json = XMLMapping.load(xml, { nested: true });\nconsole.log(json);\n\n// Should output:\n// { title : { $t : 'Title is<strong>important</strong>', strong: { '$t': 'important' }} }\n```\n\n* `arrays` - *array* - an array of basic XPath strings that specify XML nodes that should be array, even when there is only one such node.\n\n```javascript\nvar xml = '<key1>value1</key1><key2><key3>value3</key3></key2>';\nvar json = XMLMapping.load(xml, {\n arrays: [\n  '/key1',\n  '/key2/key3'\n ]\n});\nconsole.log(json);\n\n// Should output:\n// (Note that value of key1 and key3 are arrays, as specified in options)\n// {\"key1\":[{\"$t\":\"value1\"}],\"key2\":{\"key3\":[{\"$t\":\"value3\"}]}}\n```\n\n\n## dump(Object json, Object options)\nTransform a Javascript data structure (JSON) in XML string. **Return String.**\n\n###Options\n\n**Warning : options break the symmetry. This means that the XML generated may not reproduce the same JSON**\n\n* `indent` - *boolean* - Flag to throw errors of the SAX Parser ; *default : false*\n* `header` - *boolean* - Flag to add XML header; *default : false*\n* `version` - *string* - Set version attribute of XML header (see header flag); *default : 1.0*\n* `encoding` - *string* - Set encoding attribute of XML header (see header flag); *default : UTF-8*\n* `specialChar` - *string* - Set the first character of XML tag ($t, $text, $cd, $cdata, $e, $element, $c, $comment); *default : $*\n\n\n## tojson(String xml)\nAlias of load.\n\n## toxml(Object json)\nAlias of dump.\n\n# Also\n\n* https://github.com/estheban/node-json2xml\n* https://github.com/buglabs/node-xml2json\n\n# License\n\n[MIT/X11](https://raw.github.com/touv/node-xml-mapping/master/LICENSE)\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/touv/node-xml-mapping/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","publish_time":1374221104268,"_cnpm_publish_time":1374221104268,"dist-tags":{"latest":"1.7.2"}}