On Tue, 2004-11-16 at 08:51 -0600, Jay Blanchard wrote:
> [snip]
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > 
> > ... it throws an error from xml_get_error_code
> 
>   Trim your xml file.  Whitespace can cause this problem.
> [/snip]
> 
> I trimmed and chopped to no avail. Argh.
Try this snippet which has worked for me in the past.  If you can email me the 
xml file in question, I can run
it through my parser directly.

Anyway, hope this helps:

while ($data = fread($fp, 4096)){
   $data=eregi_replace(">"."[[:space:]]+"."<","><",$data);
   if (!xml_parse($xmlparser, $data, feof($fp))) {
      $reason = xml_error_string(xml_get_error_code($xmlparser));
      $reason .= xml_get_current_line_number($xmlparser);
      die($reason);
   }
}
-- 

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

Reply via email to