Forum Moderators: coopster

Message Too Old, No Replies

I.E giving correct out however FF doesn't

Firefox giving weird problem in xml Out through php

         

phparion

8:15 am on Jun 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



PHP Code:
$xml_handle = "<?xml version=\"1.0\" encoding=\"iso-8859-7\"?>\r\n";
$xml_handle .= "<student>\r\n";
$xml_handle .= "<error>Your Admission has been terminated</error>\r\n";
$xml_handle .= "</student>\r\n";
header('Content-Type: application/xml');
echo $xml_handle;

I am using this code and it is giving valid output when i browse through I.E. but when i use FireFox it gives me invalid XML following error

Code:
XML Parsing Error: xml declaration not at start of external entity
Location: [domain.com...]
Line Number 2, Column 1:<?xml version="1.0" encoding="iso-8859-7"?>

FireFox shows a pointer at the beginning of XML file at <?xml...

I am stuck with it that why I.E is showing correct output and FireFox is giving problem. Please help me to solve this problem.

thanks

ChadSEO

2:08 pm on Jun 13, 2006 (gmt 0)

10+ Year Member



phparion,

There is likely something in your PHP file before that code - even a line break would be enough to prevent Firefox from validating the XML. The <?xml needs to be the very first thing outputted. IE tends to be a little more forgiving about this. Hopefully that points you in the right direction.

Chad