{"_id":"xml-to-js","_rev":"33-f073a1b555ff217ae4f91b6c0738f168","name":"xml-to-js","description":"Translates an XML string into a JavaScript object","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.1":{"name":"xml-to-js","version":"0.0.1","description":"Translates an XML string into a JavaScript object","main":"xml-parse.js","author":{"name":"James H. Edwards"},"keywords":["XML","ORM","Object","parser"],"repository":{"type":"git","url":"https://github.com/incrediblesound/xml-to-js"},"engines":{"node":"*"},"bugs":{"url":"https://github.com/incrediblesound/xml-to-js/issues"},"homepage":"https://github.com/incrediblesound/xml-to-js","_id":"xml-to-js@0.0.1","dist":{"shasum":"6e91401a57c563505032680dfa6e99dfc79bd5c1","tarball":"https://registry.npmjs.org/xml-to-js/-/xml-to-js-0.0.1.tgz","integrity":"sha512-O+ZCmdlhxvQuXdeNXRXqLtFUcA7yZB1Bw9OaWksgX2oLktzGcjF0mEfPqZgAIYVBtLsih9Ke3bUq3jHwjzz4fw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICyT6nKLsJgyJQdq1nlw4M1DMa5TNYs4iFaEybhzFZYlAiBC02jGufxJPPKqYOeC68WAXAF8Xtyfqvse/dT6bsbRqA=="}]},"_from":".","_npmVersion":"1.3.15","_npmUser":{"name":"jhedwards","email":"james.howe.edwards@gmail.com"},"maintainers":[{"name":"jhedwards","email":"james.howe.edwards@gmail.com"}]},"0.0.2":{"name":"xml-to-js","version":"0.0.2","description":"Translates an XML string into a JavaScript object","main":"xml-parse.js","author":{"name":"James H. Edwards"},"keywords":["XML","ORM","Object","parser"],"repository":{"type":"git","url":"https://github.com/incrediblesound/xml-to-js"},"engines":{"node":"*"},"bugs":{"url":"https://github.com/incrediblesound/xml-to-js/issues"},"homepage":"https://github.com/incrediblesound/xml-to-js","_id":"xml-to-js@0.0.2","dist":{"shasum":"835aca1b5d02b3598224dc7b1773f5b0fa916c29","tarball":"https://registry.npmjs.org/xml-to-js/-/xml-to-js-0.0.2.tgz","integrity":"sha512-BQRoMgTXwqaqELmJzSI5GHOnZl5DUCCyjd/Msufy6gHwAdx3Gl5Iuc0flawmlrpb2aKg/IEGB4cVosw/nO1xPg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCxrMUINK61JFRJy6MI7wk/SqofsjMMrKy5t8FdQA9tgwIgJNXbR9vBFDdekRpz1N4FqaRK5QHBvTgfCzg8TE//XE0="}]},"_from":".","_npmVersion":"1.3.15","_npmUser":{"name":"jhedwards","email":"james.howe.edwards@gmail.com"},"maintainers":[{"name":"jhedwards","email":"james.howe.edwards@gmail.com"}]},"0.0.3":{"name":"xml-to-js","version":"0.0.3","description":"Translates an XML string into a JavaScript object","main":"xml-parse.js","author":{"name":"James H. Edwards"},"keywords":["XML","ORM","Object","parser"],"repository":{"type":"git","url":"https://github.com/incrediblesound/xml-to-js"},"engines":{"node":"*"},"bugs":{"url":"https://github.com/incrediblesound/xml-to-js/issues"},"homepage":"https://github.com/incrediblesound/xml-to-js","_id":"xml-to-js@0.0.3","dist":{"shasum":"41b8ecab96509d9cd1d26ee05f7cf468b68f7ee2","tarball":"https://registry.npmjs.org/xml-to-js/-/xml-to-js-0.0.3.tgz","integrity":"sha512-VUvuwc8hM2OFueFWKpttAjh4Ugu2DKnM9ctmawo42GVnQkVMvRGIYv7RsUqx5EGjeUdhqD6d06bep7BVtLxrpg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLPu7CNxbvRNXpx1NMIzS6IkbVM62bMwMn+JhWKJ6d2gIgcGW69JFLMKZu/dJE2GLwfdeykw9M5I1JMmGGvEk/U1o="}]},"_from":".","_npmVersion":"1.3.15","_npmUser":{"name":"jhedwards","email":"james.howe.edwards@gmail.com"},"maintainers":[{"name":"jhedwards","email":"james.howe.edwards@gmail.com"}]},"0.0.4":{"name":"xml-to-js","version":"0.0.4","description":"Translates an XML string into a JavaScript object","main":"xml-parse.js","author":{"name":"James H. Edwards"},"keywords":["XML","ORM","Object","parser"],"repository":{"type":"git","url":"https://github.com/incrediblesound/xml-to-js"},"engines":{"node":"*"},"bugs":{"url":"https://github.com/incrediblesound/xml-to-js/issues"},"homepage":"https://github.com/incrediblesound/xml-to-js","_id":"xml-to-js@0.0.4","dist":{"shasum":"999f04bdd5707ac76cbb59a3e15308a4ba59358a","tarball":"https://registry.npmjs.org/xml-to-js/-/xml-to-js-0.0.4.tgz","integrity":"sha512-5w+OM+/lEY19+TbVYyoPrkpxz3JWlUlhEfVAyO3RkFzsLqvsMC0TAX2sfuT/lPpiotbCm1gn3CrPq3IHr+2j8g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC7k2sOE15g6G8D0GrgUyOCcu/xUqD5AWLXQuvSvwBz2QIgJjmqo1FmMU2zuG8wKs9/Lk2ajQFHv2AzloImBCy9V7k="}]},"_from":".","_npmVersion":"1.3.15","_npmUser":{"name":"jhedwards","email":"james.howe.edwards@gmail.com"},"maintainers":[{"name":"jhedwards","email":"james.howe.edwards@gmail.com"}]},"0.0.5":{"name":"xml-to-js","version":"0.0.5","description":"Translates an XML string into a JavaScript object","main":"xml-parse.js","author":{"name":"James H. Edwards"},"keywords":["XML","ORM","Object","parser"],"repository":{"type":"git","url":"https://github.com/incrediblesound/xml-to-js"},"engines":{"node":"*"},"bugs":{"url":"https://github.com/incrediblesound/xml-to-js/issues"},"homepage":"https://github.com/incrediblesound/xml-to-js","_id":"xml-to-js@0.0.5","dist":{"shasum":"c664b8996e531d85d896b2b3142b45ab635b6a2b","tarball":"https://registry.npmjs.org/xml-to-js/-/xml-to-js-0.0.5.tgz","integrity":"sha512-2dLRkDvgFxtqZZHJqVeB9Kdni0YOUMwa5BwNXFTv8t8jwnxuJcJkl9T+Kj3zkijBfLV9/9xx0hNVjFxQmaWbag==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICKFdtMDjPxINXJzQBc6bFdAAVyDFiGQI8C96XNy86NEAiAGuBqW5DqAoINhOODT5FoTtxwyqF43nr4Aqhs4KaIw6Q=="}]},"_from":".","_npmVersion":"1.3.15","_npmUser":{"name":"jhedwards","email":"james.howe.edwards@gmail.com"},"maintainers":[{"name":"jhedwards","email":"james.howe.edwards@gmail.com"}]},"0.0.6":{"name":"xml-to-js","version":"0.0.6","description":"Translates an XML string into a JavaScript object","main":"xml-parse.js","author":{"name":"James H. Edwards"},"keywords":["XML","ORM","Object","parser"],"repository":{"type":"git","url":"https://github.com/incrediblesound/xml-to-js"},"engines":{"node":"*"},"bugs":{"url":"https://github.com/incrediblesound/xml-to-js/issues"},"homepage":"https://github.com/incrediblesound/xml-to-js","_id":"xml-to-js@0.0.6","dist":{"shasum":"6423bf918672dac44219ff8bbedb979229da38cd","tarball":"https://registry.npmjs.org/xml-to-js/-/xml-to-js-0.0.6.tgz","integrity":"sha512-xdLB2B/UPN93ooHzpj1c4RproeReTOTGXzEu4pvDky37XwDUUdDcXV/8p4Yoio2wHutP63jTdieQvjPITG/pHg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBFNdKrLWWXI9EplIehEX2iojoqouO+2T+e/aVscwH1jAiEA8OQ8xd3c3Sq2HdFjv79c8GkXSX9WkfJ48NQTU3QVzM8="}]},"_from":".","_npmVersion":"1.3.15","_npmUser":{"name":"jhedwards","email":"james.howe.edwards@gmail.com"},"maintainers":[{"name":"jhedwards","email":"james.howe.edwards@gmail.com"}]},"0.0.7":{"name":"xml-to-js","version":"0.0.7","description":"Translates an XML string into a JavaScript object","main":"xml-parse.js","author":{"name":"James H. Edwards"},"keywords":["XML","ORM","Object","parser"],"repository":{"type":"git","url":"https://github.com/incrediblesound/xml-to-js"},"devDependencies":{"mocha":"2.0.1","chai":"1.9.2"},"engines":{"node":"*"},"bugs":{"url":"https://github.com/incrediblesound/xml-to-js/issues"},"homepage":"https://github.com/incrediblesound/xml-to-js","_id":"xml-to-js@0.0.7","dist":{"shasum":"f7511313e7685fc0edaa28d03c3b8047954ee075","tarball":"https://registry.npmjs.org/xml-to-js/-/xml-to-js-0.0.7.tgz","integrity":"sha512-Vz6FR4vPARNS8X5wVGrBeKb3Gx2FPZ3hITwy61zi6zkM3kEy6dzqtW+ahdKN1SV+q8jwr7/6Gcd/s17cGKs7vg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEutBadrbJSKpVolY+pU69WinDwLFxDf2D778Gp5gOOsAiAcp2uOJ5PQuNndKVdm+D7OEK99BWyIrxmWapcOsBobOQ=="}]},"_from":".","_npmVersion":"1.3.15","_npmUser":{"name":"jhedwards","email":"james.howe.edwards@gmail.com"},"maintainers":[{"name":"jhedwards","email":"james.howe.edwards@gmail.com"}]}},"readme":"xml-to-js\n=========\n<img src='https://travis-ci.org/incrediblesound/xml-to-js.svg?branch=master'></img>\n\n<strong>New in 0.0.5</strong> Added support for empty spaces and the following characters where they occur as content between tags: ! ? ( ) - . & % @ : $     \nThe following value type will no longer cause an error: !i-hate $not?@snide.com     \n\nThe object of this module is to provide a direct translation of XML into a JavaScript object. The input paramaters are fairly strict which I'm hoping will result in a straight-forward and lightning fast, if somewhat specialized, module. The XML can only contain \"container\" tags and key value tags, for example:\n\n    var x = '<maps><china><ancient><map1>changsha</map1><map2>xian</map2></ancient><modern><map1>Shanghai</map1></modern></china></maps>';\n\nThe main function is xmlToJs which is used thusly:\n\n    var makeObject = require('xml-to-js').xmlToJs;\n\n    makeObject(x, function(object) {\n      console.log(object);\n\t})\n\nWhich renders the following object:\n\n{ maps: { \n    china: { \n        ancient: { \n            map1: 'Changsha', \n            map2: 'xian'\n            }, \n        modern: { \n            map1: 'Shanghai' \n            } \n        } \n      } \n    }\n\nThe function rawData spits out the data used to make the object and populate it's key-value fields, it returns an object with an \"index\" property that contains all the container data, and a \"values\" property that contains the key-value data:\n\n    var getData = require('xml-to-js').rawData;\n    \n    getData(x, function(data) {\n      console.log(data.index);\n      res.render('index');\n    })\n    \n    //=>{ index: [ [ { value: 'maps', parent: undefined } ],[ { value: 'china', parent: 'maps' } ],[ { value: 'ancient', parent: 'china' },{ value: 'modern', parent: 'china' } ] ],values: [ { level: 3, key: 'map1', parent: 'ancient', value: 'changsha' }, { level: 3, key: 'map2', parent: 'ancient', value: 'xian' },{ level: 3, key: 'map1', parent: 'modern', value: 'shanghai' } ] }\n\nIf for some reason you want to obtain an empty object, that is, a JS object without the key-value pairs contained in the XML, use the emptyObject function:\n\n    var emptyObject = require('xml-to-js').emptyObject;\n    \n    emptyObject(x, function(object) {\n      console.log(object);\n    })\n    \n    //=> { maps: { china: { ancient: {}, modern: {} } } }\n\nIf your XML object has multiple root nodes you can use xmlToJsArray to return an array of objects for each root node:\n\n    var xml = '<people><john><place>2</place></john><mary><place>1</place></mary></people><things><cleanup>broom</cleanup><records>penpaper</records></things>'\n\n    var makeObjectArray = require('xml-to-js').xmlToJsArray;\n\n    makeObjectArray(xml, function (object) {\n    console.log(object);\n    })\n\n    //=> [ { people: { john: { place: '2' }, mary: { place: '1' } } }, { things: { cleanup: 'broom', records: 'penpaper' } } ]\n    \n","maintainers":[{"name":"jhedwards","email":"james.howe.edwards@gmail.com"}],"time":{"modified":"2022-06-29T05:37:48.057Z","created":"2014-05-09T08:41:52.636Z","0.0.1":"2014-05-09T08:41:57.465Z","0.0.2":"2014-05-09T08:45:54.562Z","0.0.3":"2014-05-09T11:06:12.706Z","0.0.4":"2014-05-10T08:40:55.865Z","0.0.5":"2014-05-19T11:25:57.652Z","0.0.6":"2014-06-24T12:46:39.138Z","0.0.7":"2014-10-25T01:05:41.697Z"},"readmeFilename":"README.md","homepage":"https://github.com/incrediblesound/xml-to-js","keywords":["XML","ORM","Object","parser"],"repository":{"type":"git","url":"https://github.com/incrediblesound/xml-to-js"},"author":{"name":"James H. Edwards"},"bugs":{"url":"https://github.com/incrediblesound/xml-to-js/issues"}}