Reputation: 53
The PHP code is this:-
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<example>\n";
echo "</example>";
The result is this:-
<?xml version="1.0" encoding="utf-8" /?>
<head/><example>
</example>
Why is this < head/ > tag appearing? How can I get rid of it?
Upvotes: 1
Views: 451
Reputation: 99921
Most probably, you are sending the XML with a HTML content-type, and there is a HTML post processor like mod_pagespeed or cloudflare taking place between this PHP script and the browser.
You should try sending the XML with a proper content type like application/xml
:
header("Content-Type: application/xml");
Upvotes: 5