All,
I'm writing PHP on Eclipse and using Wampserver to view my code on Firefox. I'm encountering a weird error. Here is an example of the code that produces the error:
<?php
header("Content-Type: text/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8" ?>';
$stringResult='ABC';
echo $stringResult;
?>
This gives me the Firefox yellow screen of death and the following message:
XML Parsing Error: syntax error
Location: http://localhost/Tests/2013.09_xml_parsing_error/
Line Number 1, Column 40:<?xml version="1.0" encoding="utf-8" ?>ABC
----------------------------------------------------------------^
(Note that on Firefox the -----^
points straight after ..."utf-8" ?>
)
What's causing this?
EDIT: I'm also getting an error if I just write:
<?php
header("Content-Type: text/xml; charset=utf-8");
$stringResult='ABC';
echo $stringResult;
?>
I get the following error:
XML Parsing Error: syntax error
Location: http://localhost/Tests/2013.09_xml_parsing_error/
Line Number 1, Column 1:ABC
^