Hi all
Hope someone can help me. I'm just dipping my toe into working with XML documents and I'm having a problem. I'm doing my development using the XAMPP home server package and, so far, I've managed to successfully read documents without a problem. I'm now taking the next step of adding to and creating new XML sheets and I'm having a look at this article here:
http://www.devshed.com/c/a/PHP/A-Quick-Overview-of-the-XML-DOM-Extension-in-PHP-5/1/
..and trying to run this piece of code from XAMPP:
$dom=new DOMDocument('1.0','iso-8859-1');
$element=$dom->createElement('testnode','This is the root element of the new DOM document');
// insert the new element as root (child of the document)
$dom->appendChild($element);
// tell the browser the output is XML via the 'Content-Type' HTTP header
header('Content-Type: text/xml');
// display DOM document
echo $dom->saveXML();
But's it's thowing up this error message:
This page contains the following errors:
error on line 1 at column 60: Space required after the Public Identifier
Below is a rendering of the page up to the first error.
Can anyone tell me, is that code valid, or is it XAMPP causing the error..?
Thanks