Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add demonstrator

  • Loading branch information...
commit 212b684c2540e1ccc311ec02d183674cbdcb63ad 1 parent 3b6209e
@touv touv authored
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>'
+
Please sign in to comment.
Something went wrong with that request. Please try again.