
var xml = require('xml4node');
var dual = require('./index');
var _ = require('underscore');


var exampleHost = function () {
    var doc = xml.doc(xml.elt('bands'));

    var host = new dual.Host();
    host.action('get')
        .route(['site'])
        .use(function (route, msg, remote) {
            remote.trigger('put', ['site'].concat(_.initial(route)), xml.nodeToString(xml.docGet(route)));
        });

    host.action('put')
        .route(['site'])
        .use(function (route, msg) {
            xml.docSet(route, msg);
        });

    host.doc = doc;
    return host;
};

var hostA = exampleHost();
var hostB = exampleHost();

hostA.serve(hostB);

hostA.trigger('put', ['site', 'bands'], xml.elt('beatles'));
hostB.emit('get', ['site', 'bands']);
console.log(hostB.doc.root);

@@ -152,21 +152,19 @@
 ml.elt('
-bands
+doc
 '));%0A%0A  
@@ -507,24 +507,36 @@
     
+xml.setNode(
 xml.doc
-S
+G
 et(route
 , ms
@@ -527,24 +527,25 @@
 docGet(route
+)
 , msg);%0A    
@@ -704,18 +704,34 @@
 e', 
+'doc'%5D, xml.elt(
 'bands'
-%5D
 , 
+%5B
 xml.
@@ -744,16 +744,36 @@
 eatles')
+, xml.elt('doors')%5D)
 );%0AhostB
@@ -793,16 +793,23 @@
 %5B'site',
+ 'doc',
  'bands'

Switch around example to something more supportable.