PHP DocDocument, in saveXML() funtion change " by "



I try to use DocDocument library, but i need the original XML text without further changes because is a signed xml with a digital certificate (XMLSecurityKey openssl).


The simples steps, loadxml and savexml change the original text.


My code is:



$PROCESSED_TEXT = "<node><child>product &amp; &apos; &gt; &lt; &quot;</child></node>";

$obj = new DOMDocument();
$obj->formatOutput = false; // (needed)
$obj->preserveWhiteSpace = true; // (needed)
$obj->encoding = 'ISO-8859-1'; // (needed)

$obj->loadXML($PROCESSED_TEXT);

$strXMLFinal = $obj->saveXML();

echo $strXMLFinal;


OUTPUT:



<node><child>producto &amp; ' &gt; &lt; "</child></node>


I need the same:



<node><child>product &amp; &apos; &gt; &lt; &quot;</child></node>


I tried without success with:



$obj->xmlStandalone = true;
$obj->substituteEntities = false;
$obj->resolveExternals = false;
$obj->strictErrorChecking = false;


Any idea?


Thanks.


No comments:

Post a Comment