In JavaScript (server side nodejs) I\'m writing a program which generates xml as output.
I am building the xml by concatenating a string:
str += \'&l
maybe you can try this,
function encodeXML(s) { const dom = document.createElement('div') dom.textContent = s return dom.innerHTML }
reference