Re: XML + PHP is going to eat my shorts

From: Date: Tue, 16 Nov 2004 14:30:23 +0000
Subject: Re: XML + PHP is going to eat my shorts
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-202147@lists.php.net to get a copy of this message
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. --

« previous php.general (#202147) next »