[thelist] [XML] PHP creation of XML.. not starting at top of page..?

Ken Snyder kendsnyder at gmail.com
Tue May 20 10:02:56 CDT 2008

Tris wrote:
> http://www.brothersandsisters.co.uk/brand/getXml.php?id=2
> In the URL above, i'm trying to create an XML file.
> I'l calling the DB and then loopuing through the recieved array, to create XML.
> All seems to work, but there's a gap at the top of my code..
> The very bottom of my code is:
> ============
> ...
> ?>
> <?=$showXml ?>
> ============
> So I can see that there's a line, but if I remove that line to give:
> ?><?=$showXml ?>
> there's still 3 spaces that appear tio be invalid..
> so.. how can I put the first line of text at the very top left of my code?
> Tris...
There may be some spaces in an included file.  You can ensure that 
nothing is output before the xml by using ob_start() and ob_get_clean():

// include files here
// do processing here
$unwantedOutput = ob_get_clean();
?><?=$showXml ?>

- Ken Snyder

More information about the thelist mailing list