Re: [xml] xmlReaderForIO



On Mon, May 03, 2004 at 04:18:08PM +0200, Minor Gordon wrote:
Hello,

I am trying to use xmlReaderForIO() to read from some custom buffer 
structures.  I couldn't find any examples of this in the documentation, 
so I'm winging it.

  http://xmlsoft.org/examples/io1.c
  gives a somewhat similar example even if it does not use that API.

For the IO reader, I have:
xmlTextReaderPtr reader = 
xmlReaderForIO((xmlInputReadCallback)xmlReadBuffers,NULL,NULL,"sbns", 
NULL, 0);

which I've tried in several variations (giving an encoding "utf-8", 
makin a dummy close callback, passing an object in ioctx, etc.).  This 
is the variation I want.

The function xmlReadBuffers has the signature:
int xmlReadBuffers(void * context, char * buffer, int len)

When the program hits the first line (reader = ) it jumps into nowhere.  
Not exactly nowhere -- access violation at 0x00000010.  Like it's trying 
to access an element of an array that's actually a NULL pointer.
I don't think it's an environment problem, because the file reader works 
(so the DLLs are loading).

Is there something with the code?

  Impossible to say without seeing the code. Make sure first 
that the given example work in your environemnt then if yes,
the best thing is to use a debugger to trace what's happening.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://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]