Re: [xml] Progress control when using SAX



On Wed, Apr 17, 2002 at 02:40:13PM +0200, Jordi Rovira i Bonet wrote:

Hello,

    I'm using the SAX interface to parse big XML files (around 100 Mb.). 
I switched from DOM to SAX because of the size of files, but now i don't 
know how to control the progress of the parsing operation (to show a 
progress bar to the user). I know that is possible to get the line of 
the file where the parsing is in a given moment, but this doesn't seem 
the best way to do this (XML file could be only one line and 100 Mb). 
Apart of this you sholud know a priori the number of lines of the file.
    I guess that i'm not the first one to have this problem but i 
haven't found any documentation or messages in the mailing list about it.
    Any help would be appreciated.

  it is accessible from the internal parser context as
     ctxt->input->line
if you manage to make the parser context accessible as part of your
SAX callback data this should work. 
But the most presice way is to use a push based interface, in that case
you control the progress and providing back precise informations becomes
trivial.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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