`htmlentities` encodes certain HTML entities like `£ -> &pound;` which are not valid in XML (they are defined in the HTML DTD). Consequently, trying to load an XML document containing them will cause an 'unknown entity' error/warning.

`htmlspecialchars` only encodes the entities defined in XML: &gt;, &lt; and so on, i.e. the minimum subset required to escape properly-encoded text.