I'm currently trying to generate XML using PHP and DOMDocument class.
// creating xml 'ServiceProfile'
$xmlServiceProfile = new DOMDocument('1.0', 'utf-8');
$xmlServiceProfile->formatOutput = true;
$root = $xmlServiceProfile->createElement('*******');
$serveur = $xmlServiceProfile->createElement('******', creeServeurLong(*****));
$archive = $xmlServiceProfile->createElement('******', "******");
$taskList = $xmlServiceProfile->createElement('******');
foreach($array as $key => $value) {
$task = $xmlServiceProfile->createElement($key, $value);
$taskList->appendChild($task);
}
//adding nodes
$root->appendChild($******);
$root->appendChild($******);
$root->appendChild($******);
$xmlServiceProfile->appendChild($root);
echo $xmlServiceProfile->saveXML();
I've got error that mean XML generation failed, but I have a good XML in my http response.
I checked the XML on a website and got
#65279;<?xml version="1.0" encoding="utf-8"?>
I already tryed to :
change document to UTF-8 without BOM, not working
Add trim()
function on DOMDocument::saveXML()
Add htmlspecialchar()
function on DOMDocument::saveXML()
Someone help please?