CakePHP Xml utility library triggers DOMDocument warning

This is a bug in PHPs DOMDocument::createElement() method. Here are two ways to avoid the problem. Create Text Nodes Create the textnode separately and append it to the element node. $dom = new DOMDocument; $dom ->appendChild($dom->createElement(‘element’)) ->appendChild($dom->createTextNode(‘S & T: ERROR’)); var_dump($dom->saveXml()); Output: string(58) “<?xml version=”1.0″?> <element>S &amp; T: ERROR</element> ” This is the originally intended … Read more