Annotation of XML/xmlIO.h, revision 1.19

1.1       daniel      1: /*
                      2:  * xmlIO.h : interface for the I/O interfaces used by the parser
                      3:  *
                      4:  * See Copyright for the status of this software.
                      5:  *
                      6:  * Daniel.Veillard@w3.org
                      7:  */
                      8: 
                      9: #ifndef __XML_IO_H__
                     10: #define __XML_IO_H__
                     11: 
                     12: #include <stdio.h>
1.12      daniel     13: #include <libxml/tree.h>
                     14: #include <libxml/parser.h>
                     15: #include <libxml/encoding.h>
1.1       daniel     16: 
                     17: #ifdef __cplusplus
                     18: extern "C" {
                     19: #endif
                     20: 
1.17      daniel     21: /*
                     22:  * Those are the functions and datatypes for the parser input
                     23:  * I/O structures.
                     24:  */
                     25: 
1.13      daniel     26: typedef int (*xmlInputMatchCallback) (char const *filename);
                     27: typedef void * (*xmlInputOpenCallback) (char const *filename);
                     28: typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
                     29: typedef void (*xmlInputCloseCallback) (void * context);
                     30: 
1.10      daniel     31: typedef struct _xmlParserInputBuffer xmlParserInputBuffer;
                     32: typedef xmlParserInputBuffer *xmlParserInputBufferPtr;
                     33: struct _xmlParserInputBuffer {
1.13      daniel     34:     void*                  context;
                     35:     xmlInputReadCallback   readcallback;
                     36:     xmlInputCloseCallback  closecallback;
1.1       daniel     37:     
1.2       daniel     38:     xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
1.1       daniel     39:     
1.17      daniel     40:     xmlBufferPtr buffer;    /* Local buffer encoded in UTF-8 or ISOLatin */
1.16      daniel     41:     xmlBufferPtr raw;       /* if encoder != NULL buffer for raw input */
1.10      daniel     42: };
1.1       daniel     43: 
1.18      daniel     44: 
1.17      daniel     45: /*
                     46:  * Those are the functions and datatypes for the library output
                     47:  * I/O structures.
                     48:  */
                     49: 
                     50: typedef int (*xmlOutputMatchCallback) (char const *filename);
                     51: typedef void * (*xmlOutputOpenCallback) (char const *filename);
                     52: typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
                     53:                                        int len);
                     54: typedef void (*xmlOutputCloseCallback) (void * context);
                     55: 
                     56: typedef struct _xmlOutputBuffer xmlOutputBuffer;
                     57: typedef xmlOutputBuffer *xmlOutputBufferPtr;
                     58: struct _xmlOutputBuffer {
                     59:     void*                   context;
                     60:     xmlOutputWriteCallback  writecallback;
                     61:     xmlOutputCloseCallback  closecallback;
                     62:     
                     63:     xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
                     64:     
                     65:     xmlBufferPtr buffer;    /* Local buffer encoded in UTF-8 or ISOLatin */
1.18      daniel     66:     xmlBufferPtr conv;      /* if encoder != NULL buffer for output */
                     67:     int written;            /* total number of byte written */
1.17      daniel     68: };
                     69: 
1.2       daniel     70: /*
1.17      daniel     71:  * Interfaces for input
1.2       daniel     72:  */
                     73: 
1.5       daniel     74: xmlParserInputBufferPtr
1.9       daniel     75:        xmlAllocParserInputBuffer               (xmlCharEncoding enc);
                     76: 
                     77: xmlParserInputBufferPtr
1.15      daniel     78:        xmlParserInputBufferCreateFilename      (const char *URI,
1.5       daniel     79:                                                  xmlCharEncoding enc);
                     80: xmlParserInputBufferPtr
                     81:        xmlParserInputBufferCreateFile          (FILE *file,
                     82:                                                  xmlCharEncoding enc);
                     83: xmlParserInputBufferPtr
                     84:        xmlParserInputBufferCreateFd            (int fd,
                     85:                                                 xmlCharEncoding enc);
1.14      daniel     86: xmlParserInputBufferPtr
                     87:        xmlParserInputBufferCreateIO            (xmlInputReadCallback   ioread,
                     88:                                                 xmlInputCloseCallback  ioclose,
                     89:                                                 void *ioctx,
                     90:                                                 xmlCharEncoding enc);
1.5       daniel     91: int    xmlParserInputBufferRead                (xmlParserInputBufferPtr in,
                     92:                                                 int len);
                     93: int    xmlParserInputBufferGrow                (xmlParserInputBufferPtr in,
                     94:                                                 int len);
1.7       daniel     95: int    xmlParserInputBufferPush                (xmlParserInputBufferPtr in,
                     96:                                                 int len,
1.8       daniel     97:                                                 const char *buf);
1.5       daniel     98: void   xmlFreeParserInputBuffer                (xmlParserInputBufferPtr in);
                     99: char * xmlParserGetDirectory                   (const char *filename);
1.1       daniel    100: 
1.13      daniel    101: int     xmlRegisterInputCallbacks              (xmlInputMatchCallback match,
                    102:                                                 xmlInputOpenCallback open,
                    103:                                                 xmlInputReadCallback read,
                    104:                                                 xmlInputCloseCallback close);
1.17      daniel    105: /*
                    106:  * Interfaces for output
                    107:  */
                    108: xmlOutputBufferPtr
                    109:        xmlAllocOutputBuffer            (xmlCharEncodingHandlerPtr encoder);
                    110: 
                    111: xmlOutputBufferPtr
                    112:        xmlOutputBufferCreateFilename   (const char *URI,
1.18      daniel    113:                                         xmlCharEncodingHandlerPtr encoder,
                    114:                                         int compression);
1.17      daniel    115: 
                    116: xmlOutputBufferPtr
                    117:        xmlOutputBufferCreateFile       (FILE *file,
                    118:                                         xmlCharEncodingHandlerPtr encoder);
                    119: 
                    120: xmlOutputBufferPtr
                    121:        xmlOutputBufferCreateFd         (int fd,
                    122:                                         xmlCharEncodingHandlerPtr encoder);
                    123: 
                    124: xmlOutputBufferPtr
                    125:        xmlOutputBufferCreateIO         (xmlOutputWriteCallback   iowrite,
                    126:                                         xmlOutputCloseCallback  ioclose,
                    127:                                         void *ioctx,
                    128:                                         xmlCharEncodingHandlerPtr encoder);
                    129: 
1.18      daniel    130: int    xmlOutputBufferWrite            (xmlOutputBufferPtr out,
1.17      daniel    131:                                         int len,
                    132:                                         const char *buf);
1.18      daniel    133: int    xmlOutputBufferWriteString      (xmlOutputBufferPtr out,
                    134:                                         const char *str);
1.17      daniel    135: 
1.18      daniel    136: int    xmlOutputBufferFlush            (xmlOutputBufferPtr out);
                    137: int    xmlOutputBufferClose            (xmlOutputBufferPtr out);
1.17      daniel    138: 
                    139: int     xmlRegisterOutputCallbacks     (xmlOutputMatchCallback match,
                    140:                                         xmlOutputOpenCallback open,
                    141:                                         xmlOutputWriteCallback write,
                    142:                                         xmlOutputCloseCallback close);
1.18      daniel    143: 
                    144: /*
                    145:  * This save function is part of tree.h actually
                    146:  */
                    147: int            xmlSaveFileTo           (xmlOutputBuffer *buf,
1.19    ! daniel    148:                                         xmlDocPtr cur,
        !           149:                                         const char *encoding);
1.1       daniel    150: #ifdef __cplusplus
                    151: }
                    152: #endif
                    153: 
                    154: #endif /* __XML_IO_H__ */

Webmaster