Skip to content

Commit

Permalink
add demonstrator
Browse files Browse the repository at this point in the history
  • Loading branch information
touv committed Feb 23, 2012
1 parent 3b6209e commit 212b684
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions examples/demonstrator
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env node

var xm = require('../lib/xml-mapping.js')
,util = require('util')
,assert = require('assert');

[
'<key>value</key>'
,'<key attr="value1">value2</key>'
,'<key><key1>value1</key1><key2>value2</key2></key>'
,'<key><key>value1</key><key>value2</key></key>'
,'<key><key><key>value2</key></key></key>'
,'<key><![CDATA[value]]></key>'
,'<key><!--value--></key>'
].forEach(function(xml) {
var json = xm.tojson(xml);
process.stdout.write(xml);
process.stdout.write('\n');
process.stdout.write(util.inspect(json, false, null, true));
process.stdout.write('\n\n');
assert.equal(xml, xm.toxml(json));
})


//,'<key>val<key>value2</key>ue1</key>'

0 comments on commit 212b684

Please sign in to comment.