expect($(c.toXML()).attr('meta-uri')).to.equal(undefined, 'setting attribute to zero length string');
         });
 
+        describe('output xml', function() {
+            it('keeps entities intact', function() {
+                var xmlIn = '<section>< ></section>',
+                    c = canvas.fromXML(xmlIn),
+                    xmlOut = c.toXML();
+                expect(xmlOut).to.equal(xmlIn);
+            });
+            it('keeps entities intact when they form html/xml', function() {
+                var xmlIn = '<section><abc></section>',
+                    c = canvas.fromXML(xmlIn),
+                    xmlOut = c.toXML();
+                expect(xmlOut).to.equal(xmlIn);
+            });
+        });
+
         describe('formatting output xml', function() {
             /*it('keeps white spaces at the edges of input xml', function() {
                 var xmlIn = '  <section></section>  ',
 
 
         for(var i = children.length - 1; i >= 0; i--) {
             childParts = children[i].toXML(level + 1);
-            
+            if(typeof childParts === 'string')
+                childParts = [document.createTextNode(childParts)];
+
             if(containsPrefixAndSuffix(i) && children[i] instanceof DocumentTextElement) {
                 $(node.contents()[0]).after(childParts);
             } else {