When I set a value of a text node with node.nodeValue="string with &#xxxx; sort of characters" ampersand gets escaped. Is there an easy way to do this? You need to use Javascript escapes for the Unicode characters: node.nodeValue="string with \uxxxx sort of characters" From http://code.google.com/p/jslibs/wiki/JavascriptTips : (converts both entity references and numeric entities) const entityToCode = { __proto__: null, apos:0x0027,quot:0x0022,amp:0x0026,lt:0x003C,gt:0x003E,nbsp:0x00A0,iexcl:0x00A1,cent:0x00A2,pound:0x00A3, curren:0x00A4,yen:0x00A5,brvbar:0x00A6,sect:0x00A7,uml:0x00A8,copy