xmlIO.h

00001 /*
00002 
00003  * Summary: interface for the I/O interfaces used by the parser
00004 
00005  * Description: interface for the I/O interfaces used by the parser
00006 
00007  *
00008 
00009  * Copy: See Copyright for the status of this software.
00010 
00011  *
00012 
00013  * Author: Daniel Veillard
00014 
00015  */
00016 
00017 
00018 
00019 #ifndef __XML_IO_H__
00020 
00021 #define __XML_IO_H__
00022 
00023 
00024 
00025 #include <stdio.h>
00026 
00027 #include <libxml/xmlversion.h>
00028 
00029 
00030 
00031 #ifdef __cplusplus
00032 
00033 extern "C" {
00034 
00035 #endif
00036 
00037 
00038 
00039 /*
00040 
00041  * Those are the functions and datatypes for the parser input
00042 
00043  * I/O structures.
00044 
00045  */
00046 
00047 
00048 
00067 typedef int (*xmlInputMatchCallback) (char const *filename);
00068 
00085 typedef void * (*xmlInputOpenCallback) (char const *filename);
00086 
00107 typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
00108 
00125 typedef int (*xmlInputCloseCallback) (void * context);
00126 
00127 
00128 
00129 #ifdef LIBXML_OUTPUT_ENABLED
00130 
00131 /*
00132 
00133  * Those are the functions and datatypes for the library output
00134 
00135  * I/O structures.
00136 
00137  */
00138 
00139 
00140 
00159 typedef int (*xmlOutputMatchCallback) (char const *filename);
00160 
00177 typedef void * (*xmlOutputOpenCallback) (char const *filename);
00178 
00199 typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
00200 
00201                                        int len);
00202 
00219 typedef int (*xmlOutputCloseCallback) (void * context);
00220 
00221 #endif /* LIBXML_OUTPUT_ENABLED */
00222 
00223 
00224 
00225 #ifdef __cplusplus
00226 
00227 }
00228 
00229 #endif
00230 
00231 
00232 
00233 #include <libxml/globals.h>
00234 
00235 #include <libxml/tree.h>
00236 
00237 #include <libxml/parser.h>
00238 
00239 #include <libxml/encoding.h>
00240 
00241 
00242 
00243 #ifdef __cplusplus
00244 
00245 extern "C" {
00246 
00247 #endif
00248 
00249 struct _xmlParserInputBuffer {
00250 
00251     void*                  context;
00252 
00253     xmlInputReadCallback   readcallback;
00254 
00255     xmlInputCloseCallback  closecallback;
00256 
00257     
00258 
00259     xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
00260 
00261     
00262 
00263     xmlBufferPtr buffer;    /* Local buffer encoded in UTF-8 */
00264 
00265     xmlBufferPtr raw;       /* if encoder != NULL buffer for raw input */
00266 
00267     int compressed;         /* -1=unknown, 0=not compressed, 1=compressed */
00268 
00269     int error;
00270 
00271     unsigned long rawconsumed;/* amount consumed from raw */
00272 
00273 };
00274 
00275 
00276 
00277 
00278 
00279 #ifdef LIBXML_OUTPUT_ENABLED
00280 
00281 struct _xmlOutputBuffer {
00282 
00283     void*                   context;
00284 
00285     xmlOutputWriteCallback  writecallback;
00286 
00287     xmlOutputCloseCallback  closecallback;
00288 
00289     
00290 
00291     xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
00292 
00293     
00294 
00295     xmlBufferPtr buffer;    /* Local buffer encoded in UTF-8 or ISOLatin */
00296 
00297     xmlBufferPtr conv;      /* if encoder != NULL buffer for output */
00298 
00299     int written;            /* total number of byte written */
00300 
00301     int error;
00302 
00303 };
00304 
00305 #endif /* LIBXML_OUTPUT_ENABLED */
00306 
00307 
00308 
00309 /*
00310 
00311  * Interfaces for input
00312 
00313  */
00314 
00315 XMLPUBFUN void XMLCALL  
00316 
00317         xmlCleanupInputCallbacks                (void);
00318 
00319 
00320 
00321 XMLPUBFUN int XMLCALL
00322 
00323         xmlPopInputCallbacks                    (void);
00324 
00325 
00326 
00327 XMLPUBFUN void XMLCALL  
00328 
00329         xmlRegisterDefaultInputCallbacks        (void);
00330 
00331 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00332 
00333         xmlAllocParserInputBuffer               (xmlCharEncoding enc);
00334 
00335 
00336 
00337 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00338 
00339         xmlParserInputBufferCreateFilename      (const char *URI,
00340 
00341                                                  xmlCharEncoding enc);
00342 
00343 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00344 
00345         xmlParserInputBufferCreateFile          (FILE *file,
00346 
00347                                                  xmlCharEncoding enc);
00348 
00349 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00350 
00351         xmlParserInputBufferCreateFd            (int fd,
00352 
00353                                                  xmlCharEncoding enc);
00354 
00355 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00356 
00357         xmlParserInputBufferCreateMem           (const char *mem, int size,
00358 
00359                                                  xmlCharEncoding enc);
00360 
00361 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00362 
00363         xmlParserInputBufferCreateStatic        (const char *mem, int size,
00364 
00365                                                  xmlCharEncoding enc);
00366 
00367 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
00368 
00369         xmlParserInputBufferCreateIO            (xmlInputReadCallback   ioread,
00370 
00371                                                  xmlInputCloseCallback  ioclose,
00372 
00373                                                  void *ioctx,
00374 
00375                                                  xmlCharEncoding enc);
00376 
00377 XMLPUBFUN int XMLCALL   
00378 
00379         xmlParserInputBufferRead                (xmlParserInputBufferPtr in,
00380 
00381                                                  int len);
00382 
00383 XMLPUBFUN int XMLCALL   
00384 
00385         xmlParserInputBufferGrow                (xmlParserInputBufferPtr in,
00386 
00387                                                  int len);
00388 
00389 XMLPUBFUN int XMLCALL   
00390 
00391         xmlParserInputBufferPush                (xmlParserInputBufferPtr in,
00392 
00393                                                  int len,
00394 
00395                                                  const char *buf);
00396 
00397 XMLPUBFUN void XMLCALL  
00398 
00399         xmlFreeParserInputBuffer                (xmlParserInputBufferPtr in);
00400 
00401 XMLPUBFUN char * XMLCALL        
00402 
00403         xmlParserGetDirectory                   (const char *filename);
00404 
00405 
00406 
00407 XMLPUBFUN int XMLCALL     
00408 
00409         xmlRegisterInputCallbacks               (xmlInputMatchCallback matchFunc,
00410 
00411                                                  xmlInputOpenCallback openFunc,
00412 
00413                                                  xmlInputReadCallback readFunc,
00414 
00415                                                  xmlInputCloseCallback closeFunc);
00416 
00417 
00418 
00419 xmlParserInputBufferPtr
00420 
00421         __xmlParserInputBufferCreateFilename(const char *URI,
00422 
00423                                                                                 xmlCharEncoding enc);
00424 
00425 
00426 
00427 #ifdef LIBXML_OUTPUT_ENABLED
00428 
00429 /*
00430 
00431  * Interfaces for output
00432 
00433  */
00434 
00435 XMLPUBFUN void XMLCALL  
00436 
00437         xmlCleanupOutputCallbacks               (void);
00438 
00439 XMLPUBFUN void XMLCALL  
00440 
00441         xmlRegisterDefaultOutputCallbacks(void);
00442 
00443 XMLPUBFUN xmlOutputBufferPtr XMLCALL
00444 
00445         xmlAllocOutputBuffer            (xmlCharEncodingHandlerPtr encoder);
00446 
00447 
00448 
00449 XMLPUBFUN xmlOutputBufferPtr XMLCALL
00450 
00451         xmlOutputBufferCreateFilename   (const char *URI,
00452 
00453                                          xmlCharEncodingHandlerPtr encoder,
00454 
00455                                          int compression);
00456 
00457 
00458 
00459 XMLPUBFUN xmlOutputBufferPtr XMLCALL
00460 
00461         xmlOutputBufferCreateFile       (FILE *file,
00462 
00463                                          xmlCharEncodingHandlerPtr encoder);
00464 
00465 
00466 
00467 XMLPUBFUN xmlOutputBufferPtr XMLCALL
00468 
00469         xmlOutputBufferCreateFd         (int fd,
00470 
00471                                          xmlCharEncodingHandlerPtr encoder);
00472 
00473 
00474 
00475 XMLPUBFUN xmlOutputBufferPtr XMLCALL
00476 
00477         xmlOutputBufferCreateIO         (xmlOutputWriteCallback   iowrite,
00478 
00479                                          xmlOutputCloseCallback  ioclose,
00480 
00481                                          void *ioctx,
00482 
00483                                          xmlCharEncodingHandlerPtr encoder);
00484 
00485 
00486 
00487 XMLPUBFUN int XMLCALL   
00488 
00489         xmlOutputBufferWrite            (xmlOutputBufferPtr out,
00490 
00491                                          int len,
00492 
00493                                          const char *buf);
00494 
00495 XMLPUBFUN int XMLCALL   
00496 
00497         xmlOutputBufferWriteString      (xmlOutputBufferPtr out,
00498 
00499                                          const char *str);
00500 
00501 XMLPUBFUN int XMLCALL   
00502 
00503         xmlOutputBufferWriteEscape      (xmlOutputBufferPtr out,
00504 
00505                                          const xmlChar *str,
00506 
00507                                          xmlCharEncodingOutputFunc escaping);
00508 
00509 
00510 
00511 XMLPUBFUN int XMLCALL   
00512 
00513         xmlOutputBufferFlush            (xmlOutputBufferPtr out);
00514 
00515 XMLPUBFUN int XMLCALL   
00516 
00517         xmlOutputBufferClose            (xmlOutputBufferPtr out);
00518 
00519 
00520 
00521 XMLPUBFUN int XMLCALL     
00522 
00523         xmlRegisterOutputCallbacks      (xmlOutputMatchCallback matchFunc,
00524 
00525                                          xmlOutputOpenCallback openFunc,
00526 
00527                                          xmlOutputWriteCallback writeFunc,
00528 
00529                                          xmlOutputCloseCallback closeFunc);
00530 
00531 
00532 
00533 xmlOutputBufferPtr
00534 
00535         __xmlOutputBufferCreateFilename(const char *URI,
00536 
00537                               xmlCharEncodingHandlerPtr encoder,
00538 
00539                               int compression);
00540 
00541 
00542 
00543 #ifdef LIBXML_HTTP_ENABLED
00544 
00545 /*  This function only exists if HTTP support built into the library  */
00546 
00547 XMLPUBFUN void XMLCALL  
00548 
00549         xmlRegisterHTTPPostCallbacks    (void );
00550 
00551 #endif /* LIBXML_HTTP_ENABLED */
00552 
00553         
00554 
00555 #endif /* LIBXML_OUTPUT_ENABLED */
00556 
00557 
00558 
00559 XMLPUBFUN xmlParserInputPtr XMLCALL
00560 
00561         xmlCheckHTTPInput               (xmlParserCtxtPtr ctxt,
00562 
00563                                          xmlParserInputPtr ret);
00564 
00565 
00566 
00567 /*
00568 
00569  * A predefined entity loader disabling network accesses
00570 
00571  */
00572 
00573 XMLPUBFUN xmlParserInputPtr XMLCALL 
00574 
00575         xmlNoNetExternalEntityLoader    (const char *URL,
00576 
00577                                          const char *ID,
00578 
00579                                          xmlParserCtxtPtr ctxt);
00580 
00581 
00582 
00583 /* 
00584 
00585  * xmlNormalizeWindowsPath is obsolete, don't use it. 
00586 
00587  * Check xmlCanonicPath in uri.h for a better alternative.
00588 
00589  */
00590 
00591 XMLPUBFUN xmlChar * XMLCALL 
00592 
00593         xmlNormalizeWindowsPath         (const xmlChar *path);
00594 
00595 
00596 
00597 XMLPUBFUN int XMLCALL   
00598 
00599         xmlCheckFilename                (const char *path);
00600 
00607 XMLPUBFUN int XMLCALL   
00608 
00609         xmlFileMatch                    (const char *filename);
00610 
00611 XMLPUBFUN void * XMLCALL        
00612 
00613         xmlFileOpen                     (const char *filename);
00614 
00615 XMLPUBFUN int XMLCALL   
00616 
00617         xmlFileRead                     (void * context, 
00618 
00619                                          char * buffer, 
00620 
00621                                          int len);
00622 
00623 XMLPUBFUN int XMLCALL   
00624 
00625         xmlFileClose                    (void * context);
00626 
00627 
00628 
00635 #ifdef LIBXML_HTTP_ENABLED
00636 
00637 XMLPUBFUN int XMLCALL   
00638 
00639         xmlIOHTTPMatch                  (const char *filename);
00640 
00641 XMLPUBFUN void * XMLCALL        
00642 
00643         xmlIOHTTPOpen                   (const char *filename);
00644 
00645 #ifdef LIBXML_OUTPUT_ENABLED
00646 
00647 XMLPUBFUN void * XMLCALL        
00648 
00649         xmlIOHTTPOpenW                  (const char * post_uri,
00650 
00651                                          int   compression );
00652 
00653 #endif /* LIBXML_OUTPUT_ENABLED */
00654 
00655 XMLPUBFUN int XMLCALL   
00656 
00657         xmlIOHTTPRead                   (void * context, 
00658 
00659                                          char * buffer, 
00660 
00661                                          int len);
00662 
00663 XMLPUBFUN int XMLCALL   
00664 
00665         xmlIOHTTPClose                  (void * context);
00666 
00667 #endif /* LIBXML_HTTP_ENABLED */
00668 
00669 
00670 
00677 #ifdef LIBXML_FTP_ENABLED 
00678 
00679 XMLPUBFUN int XMLCALL   
00680 
00681         xmlIOFTPMatch                   (const char *filename);
00682 
00683 XMLPUBFUN void * XMLCALL        
00684 
00685         xmlIOFTPOpen                    (const char *filename);
00686 
00687 XMLPUBFUN int XMLCALL   
00688 
00689         xmlIOFTPRead                    (void * context, 
00690 
00691                                          char * buffer, 
00692 
00693                                          int len);
00694 
00695 XMLPUBFUN int XMLCALL   
00696 
00697         xmlIOFTPClose                   (void * context);
00698 
00699 #endif /* LIBXML_FTP_ENABLED */
00700 
00701 
00702 
00703 #ifdef __cplusplus
00704 
00705 }
00706 
00707 #endif
00708 
00709 
00710 
00711 #endif /* __XML_IO_H__ */
00712 

Generated on Wed Jul 26 13:30:46 2006 for XSB by  doxygen 1.4.5