Topic: NEWBIE BUG NOTICE: WHITESPACE IN YOUR RETURNED XML
Yes, I just d/l this library tonight so this is something intresting I found. I would love it if someone would explain it to me to tell me why this happens. So can someone please expain the following behavior please?
Sorry if this has been covered but I didn't find it searching google so I thought I would let you fellow n00bs know about this issue that I found. Ok, so I was playing around and using an include file to get my database connection. What I have found might or might not shock you all. If you have split php tags, in other words, open tags close tags, html, open tag close tags then there cannot be any whitespace between the closing of a php tag and the next open tag. I guess what it amounts to is that there can be nothing written on the page prior to the call to
Incorrect code will cause whitespace error!!!
<?php // I am doing some php here ?> <!-- This is some html. Notice that even a blank space is considered output--> <?php //I am doing some more php here too. $xajax->ProcessRequests(); ?>
To fix this I found that I had to remove any white spaces between the closing php tag and the opening of another php tag. It is important to note that ANY HTML prior to the calling of ProcessRequests(); will result in a fatal error for your xajax application.
Correct code will NOT cause whitespace error. Notice no ouput until after ProcessRequests() is called.
<?php // I am doing some php here // note below that there is not comment or space (Hence not outputed html) ?> <?php //I am doing some more php here too. $xajax->ProcessRequests(); ?>
Whelp, this is what I found. I hope this helps someone else that beats their head against the wall like me. Any additional info on this topic would be wonderful.