Blank javascript alert from PHP-generated XML

I’m trying to load an xml file with scheduler.load(“events.xml”) and it works, but when I output the same file using php like so:
header(‘Content-type: text/xml;’);
“file_read_stuff_here”
echo $file_contents;

DhtmlxScheduler gives me a blank javascript alert and I can’t find a single character that is different in the output, but the header is a bit different, coul’d this be the cause?

And if so, is there a way to fix it?

Thease are the headers according to web-sniffer.net/

XML-file
HTTP Response Header
Name Value Delim
Status: HTTP/1.1 200 OK
Date: Sun, 16 Jan 2011 12:59:14 GMT
Server: Apache/2.0.52 (Red Hat)
Last-Modified: Thu, 13 Jan 2011 01:54:23 GMT
ETag: “5e404d-2af-98c231c0”
Accept-Ranges: bytes
Content-Length: 687
Cache-Control: max-age=172800, proxy-revalidate
Connection: close
Content-Type: text/xml

PHP-generated
Date: Sun, 16 Jan 2011 12:59:17 GMT
Server: Apache/2.0.52 (Red Hat)
X-Powered-By: PHP/4.3.9
Set-Cookie: PHPSESSID=134da6fac56ada4103641e403bc8db4f; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: max-age=60, private, proxy-revalidate
Pragma: no-cache
Content-Length: 687
Connection: close
Content-Type: text/xml;

Only
Content-Type: text/xml;
is important in header, other difference doesn’t matter

Check the data output - if you have any whitespaces before <?xml - it will be enough to break xml parsing ( limitation of ff|webkit xml parsers )

Whitespaces
I moved the code to the first line of the php-code being executed and right after the output i stop php with die();

Result: a blank javascript dialog

xml code
The file events.xml doesn’t include a <?xml -part,
but I tried adding the line echo ‘<?xml version="1.0" encoding="UTF-8"?>’;

Result: a blank javascript dialog

The output xml looks identical between the “physical” and the “php-generated” xml-files and they are exactly the same size.

I really don’t get this, but I hope there is a solution to it, dhtmlx looks like a good match for our software

Btw. do you guys have any example code that creates an xml file that works with the scheduler?

Check the attached one.
As you can see - setting the header is enough
1295271388.zip (49.5 KB)

Thank you Stanislav, you’r example helped me troubleshoot it!

The problem was that the requested URI in PHP wasn’t “event2010.xml”, but rather “event2010.xml?timeshift=-60”.

I didn’t know that, now i just need to strip off the query-string and we’re off =)

Thanks again & have a good day!