Re: [xml] libxml2 newbie question about the Reader API

On Thu, Feb 17, 2005 at 08:59:24PM +0100, Aron Stansvik wrote:
Hello xml readers.

Because of some peoples misuse of XML, I'm now writing a simple
wxWidgets application that needs to process huge XML documents. I've
tested that the libxml2 Reader API can handle the load well.

Now I want my application to give some kind of progress feedback to
the user. Is there a way to obtain the number of bytes read when using
a Reader obtained using the simple xmlReaderForFile() function, or
will I have to set up my own custom I/O handlers with
xmlReaderForIO()? I can't find any example usage of this function
anywhere, and I having a bit of a hard time deciphering how it
actually works. Googling for "xmlReaderForIO" only gives 10 hits (!).

My plan is to just stat() the file for it's size before processing it,
and then use the number of bytes read to calculate progress, so all I
need is the position in the input stream that libxml2 uses.

  There is number of simplifications in your approach, like external
parsed entities, encoding conversions.
  From a normal parser you can call this. This is more complex
than you may think. I don't think on can get the parsr from a reader 
but the option exists.

Greatful for any advice and examples of using custom I/O with the
Reader API. I've looked at the custom I/O code samples at,

  It's like the I/O from other APIs !


Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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