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