Skip to content
Browse files

add demonstrator

  • Loading branch information...
1 parent 3b6209e commit 212b684c2540e1ccc311ec02d183674cbdcb63ad @touv touv committed Feb 23, 2012
Showing with 26 additions and 0 deletions.
  1. +26 −0 examples/demonstrator
View
26 examples/demonstrator
@@ -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.
Something went wrong with that request. Please try again.