[Expat-discuss] When i run an xml file i receive this error using PHP to open the file

Reid Spencer reid at x10sys.com
Mon Nov 28 10:24:48 CET 2005


Rahim,

Most PHP files are not semantically valid because they lack the xml 
declaration. Unfortunately, adding one renders the file invalid for PHP. I 
would recommend, if you're on Unix, that you simply use "cat" to combine the 
necessary header when you parse a PHP file with any XML processor. The header 
you are missing is:

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

You might also want a DTD or Schema declaration next (see the XML specs for that).

You can get it to parse with the Unix command line:

(echo '<?xml version="1.0" encoding="UTF-8"?>' ; cat PHP_FILE) | XML_PARSER

where you replace PHP_FILE with the php file you want parsed and XML_PARSER 
with any XML parser that can read its standard input (such as expat).

Hope that helps.

Reid


Rahim @ Easy Devices.co.uk wrote:
>  
> ERROR GENERATOR AFTER RUNNING THE FILE OF PHP OPENING xml file.
>  
>  
> XML error: xml declaration not at start of external entity at line 1
>  
>  
> NOTE:
> PLEASE REPLY TO THIS MESSAGE AS EARLY AS IT IS POSSIBLE.
>  
>  
> Thanks
>  
> Best regards,
> 
> Abdul Rahim Khan
> 
> Computer Engineer
> 
> Easy Devices.co.uk
> 
> Tel: 0871 7000 156
> Fax: 0871 7000 159
> Mobile #:00447733355291
> 
> Web: www.easydevices.co.uk
> Email: rahim at easydevices.co.uk
>   
> 
> ____________________________________________________________________
>                            EMAIL DISCLAIMER
> 
> This message is for the intended recipient only. It may contain confidential
> or proprietary information. If you receive this message in error, please
> immediately delete it, destroy all copies of it and notify the sender.
> You must not use or disclose any part of this message if you are not the
> intended recipient. We may monitor all Email communication through our
> networks.
> 
> If you contact us by Email, we may store your name and address to facilitate
> communication.
> 
> Any views expressed in this message are those of the individual sender,
> except where the message states otherwise.
> 
> We take reasonable precautions to ensure our Emails are virus free. However,
> we cannot accept responsibility for any virus transmitted by us and
> recommend that you subject any incoming Email to your own virus checking
> procedures.
> 
>  
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss at libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
> 



More information about the Expat-discuss mailing list