Re: isFinal parameter in XML_Parser() and XML_ParseBuffer()
"Bob Lee" <[email protected]>
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
Passing isFinal isn't required, but passing true enables you to get an error from Expat if the XML is incomplete. Bob On 10/22/07, Albrecht Fritzsche <[email protected]> wrote: > > Hi, > > I cannot find much documentation about this isFinal parameter in calls > like XML_Parser() and XML_ParseBuffer(). Is it vital that this one was > called or can I get away w/o using it? > > My parsing loop looks like > > const size_t BUFFSIZE = 8192; > char buffer[BUFFSIZE]; > > bool done = false; > while (!done) { > int size = m_reader->read(buffer, BUFFSIZE); > if (size == 0) { > // (Debug, "End of file reached"); //<-- > break; > } > else if (size < BUFFSIZE) { > done = true; > } > > if (XML_Parse(parser, buffer, int(size), done) == 0) { > // (Warning, "Parse error"); > return false; > } > } > > So, if the file size is exactly equal to BUFFSIZE then the XML_Parser() > gets called only once, the second iteration in the while loop terminates > because the reader returns now 0. > > Do I have to add in line //<-- a > > XML_Parse(parser, buffer, 0, true); > > just for the sake of passing the EndOfFile indication? > > Thanks > Ali > > _______________________________________________ > Expat-discuss mailing list > [email protected] > http://mail.libexpat.org/mailman/listinfo/expat-discuss >