title: How to make a valid string for XML in JavaScript?
body: <p>I'm looking for a function to convert a string to the xml string with xml entities where needed. Something like <a href="http://php.net/manual/en/function.htmlentities.php" rel="nofollow noreferrer">htmlentities</a> in PHP but for XML and in Javascript.</p>
  
  <p>Thank you for any help!</p>