[xml] struct xmlOutputBuffer hand-holding
- From: "Bruce A. Johnson" <bjohnson blueridgenetworks com>
- To: xml gnome org
- Subject: [xml] struct xmlOutputBuffer hand-holding
- Date: Fri, 07 Jul 2006 17:25:47 -0400
I've messed around a bit using xmlWriter to write to a file, but now I
want to write to a socket, which could be a network socket. Looking at
the description for xmlNewTextWriter, I see that it wants an
xmlOutputBuffer structure, which is defined thusly:
Structure xmlOutputBuffer
struct _xmlOutputBuffer {
void * context
xmlOutputWriteCallback writecallback
xmlOutputCloseCallback closecallback
xmlCharEncodingHandlerPtr encoder : I18N conversions to UTF-8
xmlBufferPtr buffer : Local buffer encoded in UTF-8 or ISOLat
xmlBufferPtr conv : if encoder != NULL buffer for output
int written : total number of byte written
int error
}
I'm trying to figure out how work with this. Would one of you be so
kind as to check my inferences on what this means?
I figure that "context" is a pointer to whatever structure I define that
has the information I need for my write routine, such as the file
descriptor, and that it will be passed to me whenever a function like
xmlTextWriterWriteElement() is called. It's up to my writecallback
function to handle cases like not being able to write on the socket, or
whether to flush the output. I assume also that closecallback is
responsible for freeing any memory allocated when I created the socket,
or any other resources used by writecallback. Am I on the right track?
As for written and error: Should writecallback maintain them, or will
the xmlWriter api handle that?
Thanks!
--
Bruce A. Johnson
Chantilly, Virginia
Day of inquiry. You will be subpoenaed.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]