note 17794 deleted from function.xml-parse by jimw
| From: | jimw@php.net | Date: | Wed, 02 Jan 2002 01:31:26 +0000 |
| Subject: | note 17794 deleted from function.xml-parse by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24101@lists.php.net to get a copy of this message | ||
the optional parameter confused me for a while. I had parsed my file using:
while($data = fread($fp, 4096))
{
xml_parse($parser, $data, feof($fp))
or die(sprintf("XML Error: %s at line %d",
xml_error_string(xml_get_error_code($parser)),
xml_get_current_line_number($parser)));
}
but recieved a missing element error if I called it repeatedly. That makes perfect sense when I
think about it, the purpose of the parameter is to tell the parser that this is the last chunk of
data in the current parse. Since I had to call the parser repeatedly I used:
while($data = fread($fp, 4096))
@xml_parse($parser, $data);
Which works fine. If you are using a parser repeatedly (or recurcsively) this should do the trick.