Re: XML + PHP is going to eat my shorts

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

 



On Tue, 2004-11-16 at 08:13 -0600, Jay Blanchard wrote:
> Okie dokie....I have to parse an XML file and I continue to RTFM, STFW,
> and STFA. So I do this...
> 
> /* let's parse! */
> if($readXML = fopen(XMLDIR."testRecp.xml", "r")){
> 	while($lineXML = fread($readXML, 4096)){
> 		xml_parse($covadParser, $lineXML, feof($readXML));
> 		$darn =
> xml_error_string(xml_get_error_code($covadParser));
> 		echo "XML Error " . $darn . "<br />\n";
> 
> 	}
> } else {
> 	echo "COULD NOT READ XML FILE\n";
> }
> 
> And when the pareser hits the first line of the XML file ...
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> ... it throws an error from xml_get_error_code
> 
> "syntax error"
> 
> I have done ini_set("short_open_tag", 0);
> All of my functions and directives are in place for the xml parser.
> I have beaten my forehead against the wall.
> I have searched and googled and read and screamed.

Jay,

  Trim your xml file.  Whitespace can cause this problem.

-- 

-- 
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