I am getting the following output when running a simple script which loads a XML file, adds a node with a few child nodes to the document, then saves the XML file. Here is the link to this XML file being referenced: http://msgrapp.com/test/ajaxchat/messages.xml
Warning: DOMDocument::load(): Extra content at the end of the document in /home1/dstamp/public_html/messages.xml, line: 3 in /home1/dstamp/public_html//sendMessage.php on line 4
<?php
$doc = new DOMDocument('1.0');
$doc->load('messages.xml');
$root = $doc->createElement('MESSAGE');
$root = $doc->appendChild($root);
$dateNode = $doc->createElement('DATE');
$dateNode = $root->appendChild($dateNode);
$dateText = $doc->createTextNode(date("F j Y g:i a"));
$dateText = $dateNode->appendChild($dateText);
$senderNode = $doc->createElement('SENDER');
$senderNode = $root->appendChild($senderNode);
$senderText = $doc->createTextNode($_GET['sender']);
$senderText = $senderNode->appendChild($senderText);
$messageNode = $doc->createElement('TEXT');
$messageNode = $root->appendChild($messageNode);
$messageText = $doc->createTextNode($_GET['message']);
$messageText = $messageNode->appendChild($messageText);
$doc->save('messages.xml');
echo $doc->saveXML();
?>