0.0.0 • Published 10 years ago

vnls-xml v0.0.0

Weekly downloads
1
License
-
Repository
github
Last release
10 years ago

vnls-xml

Convert a Javascript Object to XML

Install:

Nodejs:

On node nodejs

npm install vnls
npm install vnls-xml

Then, somewhere at the top of your code

require('vnls');
require('vnls-xml');

There is no need to bind it to a var because var VNLS is made global to the nodejs process so it's behavior is exactly like in a browser environment. All-though this IS a kind of pollution on nodejs.

Browser

In a browser (you may also download the file first):

 <script type="text/javascript" src="https://raw.githubusercontent.com/jorritd/vnls/master/lib/vnls.min.js"></script>
 <script type="text/javascript" src="https://raw.githubusercontent.com/jorritd/vnls-xml/master/lib/vnls-string-xml.min.js"></script>

Usage:

var ob = {hallo:['one','two',{ob:{_prop:'prop',value:'I am text'}}]};
var s = VNLS.string.xml.create(ob, {eol:''});
expect(s).toEqual('<hallo>one</hallo><hallo>two</hallo><hallo><ob prop="prop"><value>I am text</value></ob></hallo>');
expect(1).toEqual(1);

Dependencies:

vnls

Development:

  • jasmine-node Testing npm install jasmine-node
  • nodewatch Autotesting TDD npm install nodewatch
  • uglify-js Building npm install uglify-js
  • jake rake, make, ant substitute (Java-script all the way) npm install -g jake

For jake these are the commands:

  • jake compress : build minified version in './lib/*'
  • jake test : run the specs
  • jake autotest : run the specs on a filechange for TDD

For testing in a browser environment just point your browser to 'specs/index.html'. It should run the same specs as jake test does. (The tests cover both browser and server)