├── .gitignore ├── .travis.yml ├── .versions ├── LICENSE ├── README.md ├── package.js ├── server.js └── tests.js /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | .build* 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.10" 4 | before_install: 5 | - "curl -L http://git.io/ejPSng | /bin/sh" 6 | -------------------------------------------------------------------------------- /.versions: -------------------------------------------------------------------------------- 1 | base64@1.0.3 2 | binary-heap@1.0.3 3 | callback-hook@1.0.3 4 | check@1.0.5 5 | ddp@1.1.0 6 | ejson@1.0.6 7 | geojson-utils@1.0.3 8 | id-map@1.0.3 9 | jquery@1.11.3_2 10 | json@1.0.3 11 | local-test:peerlibrary:xml2js@0.4.8_1 12 | logging@1.0.7 13 | meteor@1.1.6 14 | minimongo@1.0.8 15 | mongo@1.1.0 16 | ordered-dict@1.0.3 17 | peerlibrary:blocking@0.5.2 18 | peerlibrary:xml2js@0.4.8_1 19 | random@1.0.3 20 | retry@1.0.3 21 | test-helpers@1.0.4 22 | tinytest@1.0.5 23 | tracker@1.0.7 24 | underscore@1.0.3 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014, The PeerLibrary Project 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | xml2js smart package 2 | ==================== 3 | 4 | Meteor smart package for [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) node.js package providing 5 | a simple XML to JavaScript object converter. 6 | 7 | Adding this package to your [Meteor](http://www.meteor.com/) application adds `xml2js` object into the global scope. 8 | 9 | Additionally, a [fibers](https://github.com/laverdet/node-fibers)-enabled synchronous 10 | ([blocking](https://github.com/peerlibrary/meteor-blocking)) `parseStringSync` function is provided on the `xml2js` 11 | object. Except for the callback, it takes the same parameters as `parseString`. 12 | 13 | Server side only. 14 | 15 | Installation 16 | ------------ 17 | 18 | ``` 19 | meteor add peerlibrary:xml2js 20 | ``` 21 | -------------------------------------------------------------------------------- /package.js: -------------------------------------------------------------------------------- 1 | Package.describe({ 2 | summary: "Simple XML to JavaScript object converter", 3 | version: '0.4.8_1', 4 | name: 'peerlibrary:xml2js', 5 | git: 'https://github.com/peerlibrary/meteor-xml2js.git' 6 | }); 7 | 8 | Npm.depends({ 9 | xml2js: '0.4.8' 10 | }); 11 | 12 | Package.on_use(function (api) { 13 | api.versionsFrom('METEOR@1.0.3.2'); 14 | api.use('peerlibrary:blocking@0.5.2'); 15 | 16 | api.export('xml2js'); 17 | 18 | api.add_files([ 19 | 'server.js' 20 | ], 'server'); 21 | }); 22 | 23 | Package.on_test(function (api) { 24 | api.use(['peerlibrary:xml2js', 'tinytest', 'test-helpers'], ['server']); 25 | api.add_files('tests.js', ['server']); 26 | }); 27 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | xml2js = Npm.require('xml2js'); 2 | 3 | xml2js.parseStringSync = blocking(xml2js.parseString); -------------------------------------------------------------------------------- /tests.js: -------------------------------------------------------------------------------- 1 | Tinytest.addAsync('xml2js', function (test, onComplete) { 2 | var isDefined = false; 3 | try { 4 | xml2js; 5 | isDefined = true; 6 | } 7 | catch (e) { 8 | } 9 | test.isTrue(isDefined, "xml2js is not defined"); 10 | test.isTrue(Package['peerlibrary:xml2js'].xml2js, "Package.peerlibrary:xml2js.xml2js is not defined"); 11 | 12 | test.isTrue(xml2js.parseStringSync._blocking); 13 | 14 | var xml = "Hello xml2js!"; 15 | var js = { 16 | root: 'Hello xml2js!' 17 | }; 18 | 19 | var result = xml2js.parseStringSync(xml); 20 | test.equal(result, js, "Parsed object not equal"); 21 | 22 | xml2js.parseString(xml, function (err, result) { 23 | test.isFalse(err, "Error parsing: " + err); 24 | test.equal(result, js, "Parsed object not equal"); 25 | onComplete(); 26 | }); 27 | }); 28 | --------------------------------------------------------------------------------