{"_id":"@redsift/xml2object","_rev":"27-8cfcd47fcc3d86d871ff6020b8bda638","name":"@redsift/xml2object","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.3":{"name":"@redsift/xml2object","version":"0.1.3","author":{"name":"Red Sift"},"_id":"@redsift/xml2object@0.1.3","maintainers":[{"name":"sega057","email":"serhii.trofimenko@redsift.io"},{"name":"alkisredsift","email":"alkis.kalogeris@redsift.io"},{"name":"kit-314","email":"kit.hargreaves@redsift.io"},{"name":"julian.picht","email":"julian.picht@redsift.io"},{"name":"massimoparisi","email":"massimo.parisi@redsift.io"},{"name":"sometimesitbetterstepasideandnotusejavascript","email":"dmitry@redsift.io"},{"name":"raul.lorenzo.redsift","email":"raul.lorenzo@redsift.io"},{"name":"asaf.lerner","email":"asaf.lerner@redsift.io"},{"name":"luminous_cal","email":"caluminus@hotmail.co.uk"},{"name":"notmentat","email":"david.pegler@redsift.io"},{"name":"pierredupuis","email":"pidupuis@protonmail.com"},{"name":"hortega_rs","email":"hector.ortega@redsift.io"},{"name":"anneshackelford","email":"anne.shackelford@redsift.io"},{"name":"mcolladoredsift","email":"miguel.collado@redsift.io"},{"name":"redsift_operations","email":"operations@redsift.io"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"},{"name":"njaremek","email":"nicolas.jaremek@redsift.io"},{"name":"earada","email":"eduardo.arada@redsift.io"},{"name":"nascimj","email":"jose.nascimento@redsift.io"},{"name":"neilsaccardo","email":"neil.saccardo@redsift.io"},{"name":"bmayolasredsift","email":"bernat.mayolas@redsift.io"}],"homepage":"https://github.com/redsift/node-xml2object","bugs":{"url":"https://github.com/redsift/node-xml2object/issues"},"dist":{"shasum":"388842b1b90153b8b05e9251693285f071c9fe8a","tarball":"https://registry.npmjs.org/@redsift/xml2object/-/xml2object-0.1.3.tgz","fileCount":16,"integrity":"sha512-gCPC+J0vk6QPU+VZSs00jczqLaqoUGqZUO/MG5kuEcQG9zXdbdKq9b9pK1ShndZa+iJgX4kaklcXnz/bhrpyTQ==","signatures":[{"sig":"MEUCIBq/QhQx3i5kBRnT2yXuaJBmjn2Mt931ExD92lUX1eR1AiEAy31K8VGP8ePtmIcAyQ1jtfxd2T7DhFYDeAzew1U3rHs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18657},"main":"lib/xml2object.js","gitHead":"4e39364e0fc63b2a3865c33148e73796aff527fa","scripts":{"test":"mocha"},"_npmUser":{"name":"randalpinto","email":"randal@redsift.io"},"repository":{"url":"git://github.com/redsift/node-xml2object.git","type":"git"},"_npmVersion":"6.14.18","description":"Simple XML to JavaScript Object Converter","directories":{},"_nodeVersion":"18.18.0","dependencies":{"sax":"1.3.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":">=1.20.1"},"optionalDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/xml2object_0.1.3_1714375764124_0.5912747858494123","host":"s3://npm-registry-packages"}},"0.1.4":{"name":"@redsift/xml2object","version":"0.1.4","author":{"name":"Red Sift"},"_id":"@redsift/xml2object@0.1.4","maintainers":[{"name":"sega057","email":"serhii.trofimenko@redsift.io"},{"name":"alkisredsift","email":"alkis.kalogeris@redsift.io"},{"name":"kit-314","email":"kit.hargreaves@redsift.io"},{"name":"julian.picht","email":"julian.picht@redsift.io"},{"name":"massimoparisi","email":"massimo.parisi@redsift.io"},{"name":"sometimesitbetterstepasideandnotusejavascript","email":"dmitry@redsift.io"},{"name":"raul.lorenzo.redsift","email":"raul.lorenzo@redsift.io"},{"name":"asaf.lerner","email":"asaf.lerner@redsift.io"},{"name":"luminous_cal","email":"caluminus@hotmail.co.uk"},{"name":"notmentat","email":"david.pegler@redsift.io"},{"name":"pierredupuis","email":"pidupuis@protonmail.com"},{"name":"hortega_rs","email":"hector.ortega@redsift.io"},{"name":"anneshackelford","email":"anne.shackelford@redsift.io"},{"name":"mcolladoredsift","email":"miguel.collado@redsift.io"},{"name":"redsift_operations","email":"operations@redsift.io"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"},{"name":"njaremek","email":"nicolas.jaremek@redsift.io"},{"name":"earada","email":"eduardo.arada@redsift.io"},{"name":"nascimj","email":"jose.nascimento@redsift.io"},{"name":"neilsaccardo","email":"neil.saccardo@redsift.io"},{"name":"bmayolasredsift","email":"bernat.mayolas@redsift.io"}],"homepage":"https://github.com/redsift/node-xml2object","bugs":{"url":"https://github.com/redsift/node-xml2object/issues"},"dist":{"shasum":"4dd005181a7ae7f0703cdcd38527ff5ef7f70c40","tarball":"https://registry.npmjs.org/@redsift/xml2object/-/xml2object-0.1.4.tgz","fileCount":16,"integrity":"sha512-Pf19urHLSiU20Mn3LdxE2sQ8SUrk3GbVVSH0vUqhWlsKJsrhdda7NM8H48bj6JKl2MFwyp6KC/t0665cDJxlWg==","signatures":[{"sig":"MEUCIB2GKEV1YL0avKqzOxm95zisn8YZOURJQWgV+BH7dOo+AiEA4BKlcQSbb8zV5Cuk0qpkjNnYLNLc8tXYuPdrfc+l8D0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18657},"main":"lib/xml2object.js","gitHead":"4e39364e0fc63b2a3865c33148e73796aff527fa","scripts":{"test":"mocha"},"_npmUser":{"name":"randalpinto","email":"randal@redsift.io"},"repository":{"url":"git://github.com/redsift/node-xml2object.git","type":"git"},"_npmVersion":"6.14.18","description":"Simple XML to JavaScript Object Converter","directories":{},"_nodeVersion":"18.18.0","dependencies":{"sax":"1.3.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":">=1.20.1"},"optionalDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/xml2object_0.1.4_1714375901643_0.2822176001497172","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-04-29T07:29:24.124Z","modified":"2026-09-15T11:14:21.696Z","0.1.3":"2024-04-29T07:29:24.265Z","0.1.4":"2024-04-29T07:31:41.878Z"},"bugs":{"url":"https://github.com/redsift/node-xml2object/issues"},"author":{"name":"Red Sift"},"homepage":"https://github.com/redsift/node-xml2object","repository":{"url":"git://github.com/redsift/node-xml2object.git","type":"git"},"description":"Simple XML to JavaScript Object Converter","maintainers":[{"email":"operations@redsift.io","name":"redsift_operations"},{"email":"rahul@redsift.io","name":"rahulpowar"},{"email":"randal@redsift.io","name":"randalpinto"},{"email":"nicolas.jaremek@redsift.io","name":"njaremek"},{"email":"eduardo.arada@redsift.io","name":"earada"},{"email":"jose.cabrera@redsift.io","name":"jmccanal"},{"email":"bernat.mayolas@redsift.io","name":"bmayolasredsift"},{"email":"raul.lorenzo@redsift.io","name":"raul.lorenzo.redsift"},{"email":"pidupuis@protonmail.com","name":"pierredupuis"},{"email":"caluminus@hotmail.co.uk","name":"luminous_cal"},{"email":"hector.ortega@redsift.io","name":"hortega_rs"},{"email":"asim.gunes@smartbee.uk","name":"asimgunes"},{"email":"dmitry@redsift.io","name":"sometimesitbetterstepasideandnotusejavascript"},{"email":"serhii.trofimenko@redsift.io","name":"sega057"},{"email":"julian.picht@redsift.io","name":"julian.picht"},{"email":"pedro.jimenez@redsift.io","name":"pedro.lop.j"},{"email":"anne.shackelford@redsift.io","name":"anneshackeford"},{"email":"piero.nima@redsift.io","name":"pieronima"},{"email":"bhushan.lokhande@redsift.io","name":"bhushan-redsift"},{"email":"mike.cardwell@redsift.io","name":"mikehardenize"},{"email":"jay.singh@redsift.io","name":"jaydsingh11"},{"email":"antony.seedhouse@redsift.io","name":"synotnars"},{"email":"nadim.lahoud@redsift.io","name":"lahoud"},{"email":"juan.baquero@redsift.io","name":"jmbaquero_redsift"}],"readme":"# Node.js xml2object\n\nSimple wrapper on the [SAX.js](https://github.com/isaacs/sax-js) parser to stream xml into JavaScript objects.\n\nConverts xml elements into JavaScript objects.\n\n[![Build Status](https://drone.io/github.com/emberfeather/node-xml2object/status.png)](https://drone.io/github.com/emberfeather/node-xml2object/latest)\n\n## Install\n\n    npm install xml2object --save\n\n## Usage\n\n### From A File Name\n\n    var xml2object = require('xml2object');\n\n    // Create a new xml parser with an array of xml elements to look for\n    var parser = new xml2object([ 'animal' ], 'myAnimals.xml');\n\n    // Bind to the object event to work with the objects found in the XML file\n    parser.on('object', function(name, obj) {\n        console.log('Found an object: %s', name);\n        console.log(obj);\n    });\n\n    // Bind to the file end event to tell when the file is done being streamed\n    parser.on('end', function() {\n        console.log('Finished parsing xml!');\n    });\n\n    // Start parsing the XML\n    parser.start();\n\n### From An Input Stream\n\n    var xml2object = require('xml2object');\n    var source = fs.createReadStream('/path/to/file.xml');\n\n    // Create a new xml parser with an array of xml elements to look for\n    var parser = new xml2object([ 'animal' ], source);\n\n    // Bind to the object event to work with the objects found in the XML file\n    parser.on('object', function(name, obj) {\n        console.log('Found an object: %s', name);\n        console.log(obj);\n    });\n\n    // Bind to the file end event to tell when the file is done being streamed\n    parser.on('end', function() {\n        console.log('Finished parsing xml!');\n    });\n\n    // Start parsing the input stream\n    parser.start();\n\n### Piped From An Input Stream\n\n_Note:_ The following example uses the [`request`][1] package to simplify the http request.\n\n    var xml2object = require('xml2object');\n    var request = require('request');\n\n    // Create a new xml parser with an array of xml elements to look for\n    var parser = new xml2object([ 'animal' ]);\n\n    // Bind to the object event to work with the objects found in the XML file\n    parser.on('object', function(name, obj) {\n        console.log('Found an object: %s', name);\n        console.log(obj);\n    });\n\n    // Bind to the file end event to tell when the file is done being streamed\n    parser.on('end', function() {\n        console.log('Finished parsing xml!');\n    });\n\n    // Pipe a request into the parser\n    request.get('http://www.example.com/test.xml').pipe(parser.saxStream);\n\n\n### Advanced Options\n\n    var xml2object = require('xml2object');\n\n    // Create a new xml parser with an array of xml elements to look for\n    // but this time we have lower-level requirements\n    var parser = new xml2object([ 'Envelope' ], undefined, { xmlns:true });\n\n    // everything else the same\n\n\n## Module\n\n### xml2object(elements[, source[, saxOptions]])\n\nConstructor for creating an instance of the xml parser.\n\nThe source argument is can be a path to an xml file or an input stream.\n\nIf no source is specified you can set a readable Stream to `.source` or pipe a Stream into the `.saxStream`.\n\n    var xml2object = require('xml2object');\n\n    // Parse the myAnimals.xml file looking for <animal> elements\n    var parser = new xml2object([ 'animal' ], 'myAnimals.xml');\n\n`saxOptions` is passed directly to the [SAX parser](https://github.com/isaacs/sax-js#arguments). Options supported in node-xml2object are\n* xmlns : XML namespaces, ignore namespaces. Helpful if you don't know the namespace(s) but do know the element names (example, some uPnP XML data)\n\n### .source\n\nThe input Stream used as a source for parsing. Can be set to a xml file path or a readable stream.\n\n    var parser = new xml2object([ 'animal' ]);\n\n    parser.source = 'myAnimals.xml';\n\n### .saxStream\n\nThe underlying sax Stream. Data can be piped directly to the sax Stream using the `pipe()`.\n\n### .start()\n\nTriggers the xml file to start streaming to the parser. Call this method after you have bound to the events.\n\n    // Start parsing the XML\n    parser.start();\n\n### Event: 'object'\n\n    function(name, obj) { ... }\n\nTriggered when an object has been parsed from the XML file with the name of the element found and the actual object.\n\n### Event: 'end'\n\n    function() { ... }\n\nMarks the end of the input file when it has been completely streamed through the parser.\n\n### Event: 'start'\n\n    function() { ... }\n\nMarks the start of reading from the source. This event will not fire if using the `.saxParser.pipe()` method.\n\n## Other Notes\n\nElements being parsed cannot currently be nested. For example. if you have `root > bikes > bike > wheel` as a heirarchy and have done a `xml2object('transportation.xml', [ 'bike', 'wheel' ])` the bike objects will be returned, but the wheel elements inside the bike element will not be parsed separately.\n\n  [1]: https://github.com/mikeal/request\n","readmeFilename":"readme.md"}