RE: Newline Before XML Document

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I found the problem.

I was re-writing the page from using the old DOMXML to the new DOM.  We
recently switched to PHP5, and there's only one script (so far) that
creates XML, so it was easier to just use the domxml-php4-to-php5.php
class that is available online.  I didn't realize that there was an
extra line after the closing '?>' in that file.  That was causing the
extra "invisible" line to show up.

--
Ray Hauge
Application Development Lead
American Student Loan Services
www.americanstudentloan.com

-----Original Message-----
From: Ray Hauge 
Sent: Tuesday, December 12, 2006 9:14 AM
To: php-general@xxxxxxxxxxxxx
Subject:  Newline Before XML Document

I've read a lot of information about this error (in Firefox):

 

XML Parsing Error: xml declaration not at start of external entity

 

Basically it means that the XML did not start at the beginning of the
file.  The weird part of this is that if I save the document to a file
on the webroot and then view it that way, the XML is displayed
correctly.

 

So far I've tried using output buffering to make sure no other
information was sent before I output the XML, but that didn't work.
I've also tried replacing all return characters and newline characters,
but that also didn't work.

 

In Konqueror I get the following error message:

 

fatal parsing error: invalid name for processing instruction in line 2,
column 6

<?xml version="1.0" encoding="utf-8"?>

 

I even tried the following on the ob_get_contents():

$xml_string = substr($xml_string, strstr($xml_string, '<'));

 

Has anyone else run into this problem?  As far as I can tell this
document starts on line 1.

 

Thanks,

--

Ray Hauge

Application Development Lead

American Student Loan Services

www.americanstudentloan.com

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux