Annotation of XML/xmlIO.h, revision 1.23

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.21      veillard   40:     xmlBufferPtr buffer;    /* Local buffer encoded in UTF-8 */
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.23    ! veillard   74: void   xmlRegisterDefaultInputCallbacks        (void);
1.5       daniel     75: xmlParserInputBufferPtr
1.9       daniel     76:        xmlAllocParserInputBuffer               (xmlCharEncoding enc);
                     77: 
                     78: xmlParserInputBufferPtr
1.15      daniel     79:        xmlParserInputBufferCreateFilename      (const char *URI,
1.5       daniel     80:                                                  xmlCharEncoding enc);
                     81: xmlParserInputBufferPtr
                     82:        xmlParserInputBufferCreateFile          (FILE *file,
                     83:                                                  xmlCharEncoding enc);
                     84: xmlParserInputBufferPtr
                     85:        xmlParserInputBufferCreateFd            (int fd,
                     86:                                                 xmlCharEncoding enc);
1.14      daniel     87: xmlParserInputBufferPtr
1.20      veillard   88:        xmlParserInputBufferCreateMem           (const char *mem, int size,
                     89:                                                 xmlCharEncoding enc);
                     90: xmlParserInputBufferPtr
1.14      daniel     91:        xmlParserInputBufferCreateIO            (xmlInputReadCallback   ioread,
                     92:                                                 xmlInputCloseCallback  ioclose,
                     93:                                                 void *ioctx,
                     94:                                                 xmlCharEncoding enc);
1.5       daniel     95: int    xmlParserInputBufferRead                (xmlParserInputBufferPtr in,
                     96:                                                 int len);
                     97: int    xmlParserInputBufferGrow                (xmlParserInputBufferPtr in,
                     98:                                                 int len);
1.7       daniel     99: int    xmlParserInputBufferPush                (xmlParserInputBufferPtr in,
                    100:                                                 int len,
1.8       daniel    101:                                                 const char *buf);
1.5       daniel    102: void   xmlFreeParserInputBuffer                (xmlParserInputBufferPtr in);
                    103: char * xmlParserGetDirectory                   (const char *filename);
1.1       daniel    104: 
1.13      daniel    105: int     xmlRegisterInputCallbacks              (xmlInputMatchCallback match,
                    106:                                                 xmlInputOpenCallback open,
                    107:                                                 xmlInputReadCallback read,
                    108:                                                 xmlInputCloseCallback close);
1.17      daniel    109: /*
                    110:  * Interfaces for output
                    111:  */
1.23    ! veillard  112: void   xmlRegisterDefaultOutputCallbacks(void);
1.17      daniel    113: xmlOutputBufferPtr
                    114:        xmlAllocOutputBuffer            (xmlCharEncodingHandlerPtr encoder);
                    115: 
                    116: xmlOutputBufferPtr
                    117:        xmlOutputBufferCreateFilename   (const char *URI,
1.18      daniel    118:                                         xmlCharEncodingHandlerPtr encoder,
                    119:                                         int compression);
1.17      daniel    120: 
                    121: xmlOutputBufferPtr
                    122:        xmlOutputBufferCreateFile       (FILE *file,
                    123:                                         xmlCharEncodingHandlerPtr encoder);
                    124: 
                    125: xmlOutputBufferPtr
                    126:        xmlOutputBufferCreateFd         (int fd,
                    127:                                         xmlCharEncodingHandlerPtr encoder);
                    128: 
                    129: xmlOutputBufferPtr
                    130:        xmlOutputBufferCreateIO         (xmlOutputWriteCallback   iowrite,
                    131:                                         xmlOutputCloseCallback  ioclose,
                    132:                                         void *ioctx,
                    133:                                         xmlCharEncodingHandlerPtr encoder);
                    134: 
1.18      daniel    135: int    xmlOutputBufferWrite            (xmlOutputBufferPtr out,
1.17      daniel    136:                                         int len,
                    137:                                         const char *buf);
1.18      daniel    138: int    xmlOutputBufferWriteString      (xmlOutputBufferPtr out,
                    139:                                         const char *str);
1.17      daniel    140: 
1.18      daniel    141: int    xmlOutputBufferFlush            (xmlOutputBufferPtr out);
                    142: int    xmlOutputBufferClose            (xmlOutputBufferPtr out);
1.17      daniel    143: 
                    144: int     xmlRegisterOutputCallbacks     (xmlOutputMatchCallback match,
                    145:                                         xmlOutputOpenCallback open,
                    146:                                         xmlOutputWriteCallback write,
                    147:                                         xmlOutputCloseCallback close);
1.18      daniel    148: 
                    149: /*
                    150:  * This save function is part of tree.h actually
                    151:  */
                    152: int            xmlSaveFileTo           (xmlOutputBuffer *buf,
1.19      daniel    153:                                         xmlDocPtr cur,
                    154:                                         const char *encoding);
1.22      veillard  155: void           xmlNodeDumpOutput       (xmlOutputBufferPtr buf,
                    156:                                         xmlDocPtr doc,
                    157:                                         xmlNodePtr cur,
                    158:                                         int level,
                    159:                                         int format,
                    160:                                         const char *encoding);
1.1       daniel    161: #ifdef __cplusplus
                    162: }
                    163: #endif
                    164: 
                    165: #endif /* __XML_IO_H__ */

Webmaster