in a new project, I want to generate an XML file with PHP (I’ve done this one a lot of times) but now I’m facing a very weird problem, IE doesn’t display the XML correctly but in an old project’s directory, the XML displays correctly, but in the new project’s directory it don’t display the XML. The code is:
header('Content-Type: text/xml');
echo '<root><foo a="b">Tada</foo></root>';
In the old project’s directory, this program displays:
<?xml version="1.0"?>
-<root>
<foo a="b">Tada</foo>
</root>
But in the new project’s directory it only displays:
Tada
If I see the source code of the page, in both directories it shows:
<root><foo a="b">Tada</foo></root>
In Firefox I have no problem. Any idea of what is happening? Thanks in advance.
Marco.
I hope this can be helpul for someone with the same problem:
I’m using PSPad editor to create the PHP files and if in the Options is marked Ident. bytes in UTF-8 coding the program generates some characters at the beginning of the file and therefore the XML file is malformed. Thanks to all for the comments.