createElement('test'); $test->appendChild( $dom->createTextNode('Hello: \' | & | " | < | > ') ); $dom->appendChild($test); echo $dom->saveXML(); /* The upper code prints: Hello: ' | & | " | < | > Why aren't the ' and " escaped to ' and " ? */ ?>