[libxml-devel] Counting bytes parsed with SAX
Nolan Darilek
nolan at thewordnerd.info
Tue Apr 15 17:01:54 EDT 2008
Hello, apologies if this is documented somewhere and I'm just not
finding it. Could be a matter of me just not knowing relevant
terminology to grep for.
I'm using a library that's parsing XML using the SAX stream parser.
I'm trying to incorporate some sort of parsing progress bar into my
application, meaning that unless I'm missing something, it is
essential to know how many bytes the stream parser has processed in
all events. In looking at both the library and the libxml SAX stream
parser, though, I'm not seeing any way of getting at how many bytes
have been parsed. Most ideal would be a general-purpose callback
called whenever any valid chunk of XML is parsed, with some means of
getting at the amount of data processed. Less ideal but still valid
would be some means of getting at the raw data that generated any
given event so I can increment some sort of internal counter on the
callback.
Does anything like this currently exist in either the bindings or
libxml itself? If the latter and not the former, how difficult would
it be to add this to the bindings?
Failing that, is there some other means of implementing this sort of
functionality? One suggestion was to handle progress based on objects
in the file, not bytes parsed. Not sure I like this as much, as it
both introduces a second pass to the processing and doesn't seem as
precise.
Thanks a bunch.
More information about the libxml-devel
mailing list