title: Generating XML document in PHP (escape characters)
body: <p>I'm generating an XML document from a PHP script and I need to escape the XML special characters.
  I know the list of characters that should be escaped; but what is the correct way to do it?</p>
  
  <p>Should the characters be escaped just with backslash (\') or what is the proper way?
  Is there any built-in PHP function that can handle this for me?</p>