[xml] xmlReaderForIO


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. Environment is MSVC7, with the pre-compiled DLLs. A normal xmlReaderForFile works fine.

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?


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