xmlIO.h

Go to the documentation of this file.
00001 /*
00002  * Summary: interface for the I/O interfaces used by the parser
00003  * Description: interface for the I/O interfaces used by the parser
00004  *
00005  * Copy: See Copyright for the status of this software.
00006  *
00007  * Author: Daniel Veillard
00008  */
00009 
00010 #ifndef __XML_IO_H__
00011 #define __XML_IO_H__
00012 
00013 #include <stdio.h>
00014 #include <libxml/xmlversion.h>
00015 
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019 
00020 /*
00021  * Those are the functions and datatypes for the parser input
00022  * I/O structures.
00023  */
00024 
00034 typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename);
00043 typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename);
00054 typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len);
00063 typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
00064 
00065 #ifdef LIBXML_OUTPUT_ENABLED
00066 /*
00067  * Those are the functions and datatypes for the library output
00068  * I/O structures.
00069  */
00070 
00080 typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename);
00089 typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename);
00100 typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer,
00101                                        int len);
00110 typedef int (XMLCALL *xmlOutputCloseCallback) (void * context);
00111 #endif /* LIBXML_OUTPUT_ENABLED */
00112 
00113 #ifdef __cplusplus
00114 }
00115 #endif
00116 
00117 #include <libxml/globals.h>
00118 #include <libxml/tree.h>
00119 #include <libxml/parser.h>
00120 #include <libxml/encoding.h>
00121 
00122 #ifdef __cplusplus
00123 extern "C" {
00124 #endif
00125 struct _xmlParserInputBuffer {
00126     void*                  context;
00127     xmlInputReadCallback   readcallback;
00128     xmlInputCloseCallback  closecallback;
00129     
00130     xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
00131     
00132     xmlBufferPtr buffer;    /* Local buffer encoded in UTF-8 */
00133     xmlBufferPtr raw;       /* if encoder != NULL buffer for raw input */
00134     int compressed;     /* -1=unknown, 0=not compressed, 1=compressed */
00135     int error;
00136     unsigned long rawconsumed;/* amount consumed from raw */
00137 };
00138 
00139 
00140 #ifdef LIBXML_OUTPUT_ENABLED
00141 struct _xmlOutputBuffer {
00142     void*                   context;
00143     xmlOutputWriteCallback  writecallback;
00144     xmlOutputCloseCallback  closecallback;
00145     
00146     xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
00147     
00148     xmlBufferPtr buffer;    /* Local buffer encoded in UTF-8 or ISOLatin */
00149     xmlBufferPtr conv;      /* if encoder != NULL buffer for output */
00150     int written;            /* total number of byte written */
00151     int error;
00152 };
00153 #endif /* LIBXML_OUTPUT_ENABLED */
00154 
00155 /*
00156  * Interfaces for input
00157  */
00158 XMLPUBFUN void XMLCALL  
00159     xmlCleanupInputCallbacks        (void);
00160 
00161 XMLPUBFUN int XMLCALL
00162     xmlPopInputCallbacks            (void);
00163 
00164 XMLPUBFUN void XMLCALL  
00165     xmlRegisterDefaultInputCallbacks    (void);
00166 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00167     xmlAllocParserInputBuffer       (xmlCharEncoding enc);
00168 
00169 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00170     xmlParserInputBufferCreateFilename  (const char *URI,
00171                                                  xmlCharEncoding enc);
00172 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00173     xmlParserInputBufferCreateFile      (FILE *file,
00174                                                  xmlCharEncoding enc);
00175 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00176     xmlParserInputBufferCreateFd        (int fd,
00177                                              xmlCharEncoding enc);
00178 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00179     xmlParserInputBufferCreateMem       (const char *mem, int size,
00180                                              xmlCharEncoding enc);
00181 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00182     xmlParserInputBufferCreateStatic    (const char *mem, int size,
00183                                              xmlCharEncoding enc);
00184 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00185     xmlParserInputBufferCreateIO        (xmlInputReadCallback   ioread,
00186                          xmlInputCloseCallback  ioclose,
00187                          void *ioctx,
00188                                              xmlCharEncoding enc);
00189 XMLPUBFUN int XMLCALL   
00190     xmlParserInputBufferRead        (xmlParserInputBufferPtr in,
00191                          int len);
00192 XMLPUBFUN int XMLCALL   
00193     xmlParserInputBufferGrow        (xmlParserInputBufferPtr in,
00194                          int len);
00195 XMLPUBFUN int XMLCALL   
00196     xmlParserInputBufferPush        (xmlParserInputBufferPtr in,
00197                          int len,
00198                          const char *buf);
00199 XMLPUBFUN void XMLCALL  
00200     xmlFreeParserInputBuffer        (xmlParserInputBufferPtr in);
00201 XMLPUBFUN char * XMLCALL    
00202     xmlParserGetDirectory           (const char *filename);
00203 
00204 XMLPUBFUN int XMLCALL     
00205     xmlRegisterInputCallbacks       (xmlInputMatchCallback matchFunc,
00206                          xmlInputOpenCallback openFunc,
00207                          xmlInputReadCallback readFunc,
00208                          xmlInputCloseCallback closeFunc);
00209 
00210 xmlParserInputBufferPtr
00211     __xmlParserInputBufferCreateFilename(const char *URI,
00212                                         xmlCharEncoding enc);
00213 
00214 #ifdef LIBXML_OUTPUT_ENABLED
00215 /*
00216  * Interfaces for output
00217  */
00218 XMLPUBFUN void XMLCALL  
00219     xmlCleanupOutputCallbacks       (void);
00220 XMLPUBFUN void XMLCALL  
00221     xmlRegisterDefaultOutputCallbacks(void);
00222 XMLPUBFUN xmlOutputBufferPtr XMLCALL
00223     xmlAllocOutputBuffer        (xmlCharEncodingHandlerPtr encoder);
00224 
00225 XMLPUBFUN xmlOutputBufferPtr XMLCALL
00226     xmlOutputBufferCreateFilename   (const char *URI,
00227                      xmlCharEncodingHandlerPtr encoder,
00228                      int compression);
00229 
00230 XMLPUBFUN xmlOutputBufferPtr XMLCALL
00231     xmlOutputBufferCreateFile   (FILE *file,
00232                      xmlCharEncodingHandlerPtr encoder);
00233 
00234 XMLPUBFUN xmlOutputBufferPtr XMLCALL
00235     xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
00236                      xmlCharEncodingHandlerPtr encoder);
00237 
00238 XMLPUBFUN xmlOutputBufferPtr XMLCALL
00239     xmlOutputBufferCreateFd     (int fd,
00240                      xmlCharEncodingHandlerPtr encoder);
00241 
00242 XMLPUBFUN xmlOutputBufferPtr XMLCALL
00243     xmlOutputBufferCreateIO     (xmlOutputWriteCallback   iowrite,
00244                      xmlOutputCloseCallback  ioclose,
00245                      void *ioctx,
00246                      xmlCharEncodingHandlerPtr encoder);
00247 
00248 XMLPUBFUN int XMLCALL   
00249     xmlOutputBufferWrite        (xmlOutputBufferPtr out,
00250                      int len,
00251                      const char *buf);
00252 XMLPUBFUN int XMLCALL   
00253     xmlOutputBufferWriteString  (xmlOutputBufferPtr out,
00254                      const char *str);
00255 XMLPUBFUN int XMLCALL   
00256     xmlOutputBufferWriteEscape  (xmlOutputBufferPtr out,
00257                      const xmlChar *str,
00258                      xmlCharEncodingOutputFunc escaping);
00259 
00260 XMLPUBFUN int XMLCALL   
00261     xmlOutputBufferFlush        (xmlOutputBufferPtr out);
00262 XMLPUBFUN int XMLCALL   
00263     xmlOutputBufferClose        (xmlOutputBufferPtr out);
00264 
00265 XMLPUBFUN int XMLCALL     
00266     xmlRegisterOutputCallbacks  (xmlOutputMatchCallback matchFunc,
00267                      xmlOutputOpenCallback openFunc,
00268                      xmlOutputWriteCallback writeFunc,
00269                      xmlOutputCloseCallback closeFunc);
00270 
00271 xmlOutputBufferPtr
00272     __xmlOutputBufferCreateFilename(const char *URI,
00273                               xmlCharEncodingHandlerPtr encoder,
00274                               int compression);
00275 
00276 #ifdef LIBXML_HTTP_ENABLED
00277 /*  This function only exists if HTTP support built into the library  */
00278 XMLPUBFUN void XMLCALL  
00279     xmlRegisterHTTPPostCallbacks    (void );
00280 #endif /* LIBXML_HTTP_ENABLED */
00281     
00282 #endif /* LIBXML_OUTPUT_ENABLED */
00283 
00284 XMLPUBFUN xmlParserInputPtr XMLCALL
00285     xmlCheckHTTPInput       (xmlParserCtxtPtr ctxt,
00286                      xmlParserInputPtr ret);
00287 
00288 /*
00289  * A predefined entity loader disabling network accesses
00290  */
00291 XMLPUBFUN xmlParserInputPtr XMLCALL 
00292     xmlNoNetExternalEntityLoader    (const char *URL,
00293                      const char *ID,
00294                      xmlParserCtxtPtr ctxt);
00295 
00296 /* 
00297  * xmlNormalizeWindowsPath is obsolete, don't use it. 
00298  * Check xmlCanonicPath in uri.h for a better alternative.
00299  */
00300 XMLPUBFUN xmlChar * XMLCALL 
00301     xmlNormalizeWindowsPath     (const xmlChar *path);
00302 
00303 XMLPUBFUN int XMLCALL   
00304     xmlCheckFilename        (const char *path);
00308 XMLPUBFUN int XMLCALL   
00309     xmlFileMatch            (const char *filename);
00310 XMLPUBFUN void * XMLCALL    
00311     xmlFileOpen             (const char *filename);
00312 XMLPUBFUN int XMLCALL   
00313     xmlFileRead             (void * context, 
00314                      char * buffer, 
00315                      int len);
00316 XMLPUBFUN int XMLCALL   
00317     xmlFileClose            (void * context);
00318 
00322 #ifdef LIBXML_HTTP_ENABLED
00323 XMLPUBFUN int XMLCALL   
00324     xmlIOHTTPMatch          (const char *filename);
00325 XMLPUBFUN void * XMLCALL    
00326     xmlIOHTTPOpen           (const char *filename);
00327 #ifdef LIBXML_OUTPUT_ENABLED
00328 XMLPUBFUN void * XMLCALL    
00329     xmlIOHTTPOpenW          (const char * post_uri,
00330                      int   compression );
00331 #endif /* LIBXML_OUTPUT_ENABLED */
00332 XMLPUBFUN int XMLCALL   
00333     xmlIOHTTPRead           (void * context, 
00334                      char * buffer, 
00335                      int len);
00336 XMLPUBFUN int XMLCALL   
00337     xmlIOHTTPClose          (void * context);
00338 #endif /* LIBXML_HTTP_ENABLED */
00339 
00343 #ifdef LIBXML_FTP_ENABLED 
00344 XMLPUBFUN int XMLCALL   
00345     xmlIOFTPMatch           (const char *filename);
00346 XMLPUBFUN void * XMLCALL    
00347     xmlIOFTPOpen            (const char *filename);
00348 XMLPUBFUN int XMLCALL   
00349     xmlIOFTPRead            (void * context, 
00350                      char * buffer, 
00351                      int len);
00352 XMLPUBFUN int XMLCALL   
00353     xmlIOFTPClose           (void * context);
00354 #endif /* LIBXML_FTP_ENABLED */
00355 
00356 #ifdef __cplusplus
00357 }
00358 #endif
00359 
00360 #endif /* __XML_IO_H__ */
footer
 SourceForge.net Logo