2 * Summary: interface for the I/O interfaces used by the parser
3 * Description: interface for the I/O interfaces used by the parser
5 * Copy: See Copyright for the status of this software.
7 * Author: Daniel Veillard
8 * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
19 #include <stdapis/libxml2/libxml2_encoding.h>
26 * Those are the functions and datatypes for the parser input
31 * xmlInputMatchCallback:
32 * @param filename the filename or URI
34 * Callback used in the I/O Input API to detect if the current handler
35 * can provide input fonctionnalities for this resource.
37 * Returns 1 if yes and 0 if another Input module should be used
39 typedef int (*xmlInputMatchCallback) (char const *filename);
41 * xmlInputOpenCallback:
42 * @param filename the filename or URI
44 * Callback used in the I/O Input API to open the resource
46 * Returns an Input context or NULL in case or error
48 typedef void * (*xmlInputOpenCallback) (char const *filename);
50 * xmlInputReadCallback:
51 * @param context an Input context
52 * @param buffer the buffer to store data read
53 * @param len the length of the buffer in bytes
55 * Callback used in the I/O Input API to read the resource
57 * Returns the number of bytes read or -1 in case of error
59 typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
61 * xmlInputCloseCallback:
62 * @param context an Input context
64 * Callback used in the I/O Input API to close the resource
66 * Returns 0 or -1 in case of error
68 typedef int (*xmlInputCloseCallback) (void * context);
70 #ifdef LIBXML_OUTPUT_ENABLED
72 * Those are the functions and datatypes for the library output
77 * xmlOutputMatchCallback:
78 * @param filename the filename or URI
80 * Callback used in the I/O Output API to detect if the current handler
81 * can provide output fonctionnalities for this resource.
83 * Returns 1 if yes and 0 if another Output module should be used
85 typedef int (*xmlOutputMatchCallback) (char const *filename);
87 * xmlOutputOpenCallback:
88 * @param filename the filename or URI
90 * Callback used in the I/O Output API to open the resource
92 * Returns an Output context or NULL in case or error
94 typedef void * (*xmlOutputOpenCallback) (char const *filename);
96 * xmlOutputWriteCallback:
97 * @param context an Output context
98 * @param buffer the buffer of data to write
99 * @param len the length of the buffer in bytes
101 * Callback used in the I/O Output API to write to the resource
103 * Returns the number of bytes written or -1 in case of error
105 typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
108 * xmlOutputCloseCallback:
109 * @param context an Output context
111 * Callback used in the I/O Output API to close the resource
113 * Returns 0 or -1 in case of error
115 typedef int (*xmlOutputCloseCallback) (void * context);
116 #endif /* LIBXML_OUTPUT_ENABLED */
122 #include <stdapis/libxml2/libxml2_parser.h>
127 struct _xmlParserInputBuffer {
129 xmlInputReadCallback readcallback;
130 xmlInputCloseCallback closecallback;
132 xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
134 xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */
135 xmlBufferPtr raw; /* if encoder != NULL buffer for raw input */
136 int compressed; /* -1=unknown, 0=not compressed, 1=compressed */
138 unsigned long rawconsumed;/* amount consumed from raw */
142 #ifdef LIBXML_OUTPUT_ENABLED
143 struct _xmlOutputBuffer {
145 xmlOutputWriteCallback writecallback;
146 xmlOutputCloseCallback closecallback;
148 xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
150 xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */
151 xmlBufferPtr conv; /* if encoder != NULL buffer for output */
152 int written; /* total number of byte written */
155 #endif /* LIBXML_OUTPUT_ENABLED */
158 * Interfaces for input
160 XMLPUBFUN void XMLCALL
161 xmlCleanupInputCallbacks (void);
163 XMLPUBFUN int XMLCALL
164 xmlPopInputCallbacks (void);
166 XMLPUBFUN void XMLCALL
167 xmlRegisterDefaultInputCallbacks (void);
168 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
169 xmlAllocParserInputBuffer (xmlCharEncoding enc);
171 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
172 xmlParserInputBufferCreateFilename (const char *URI,
173 xmlCharEncoding enc);
175 #ifndef XMLENGINE_EXCLUDE_FILE_FUNC
176 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
177 xmlParserInputBufferCreateFile (FILE *file,
178 xmlCharEncoding enc);
181 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
182 xmlParserInputBufferCreateFd (int fd,
183 xmlCharEncoding enc);
184 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
185 xmlParserInputBufferCreateMem (const char *mem, int size,
186 xmlCharEncoding enc);
187 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
188 xmlParserInputBufferCreateStatic (const char *mem, int size,
189 xmlCharEncoding enc);
190 XMLPUBFUN xmlParserInputBufferPtr XMLCALL
191 xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
192 xmlInputCloseCallback ioclose,
194 xmlCharEncoding enc);
195 XMLPUBFUN int XMLCALL
196 xmlParserInputBufferRead (xmlParserInputBufferPtr in,
198 XMLPUBFUN int XMLCALL
199 xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
201 XMLPUBFUN int XMLCALL
202 xmlParserInputBufferPush (xmlParserInputBufferPtr in,
205 XMLPUBFUN void XMLCALL
206 xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
207 XMLPUBFUN char * XMLCALL
208 xmlParserGetDirectory (const char *filename);
210 XMLPUBFUN int XMLCALL
211 xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
212 xmlInputOpenCallback openFunc,
213 xmlInputReadCallback readFunc,
214 xmlInputCloseCallback closeFunc);
215 #ifdef LIBXML_OUTPUT_ENABLED
217 * Interfaces for output
219 XMLPUBFUN void XMLCALL
220 xmlCleanupOutputCallbacks (void);
221 XMLPUBFUN void XMLCALL
222 xmlRegisterDefaultOutputCallbacks(void);
223 XMLPUBFUN xmlOutputBufferPtr XMLCALL
224 xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
226 XMLPUBFUN xmlOutputBufferPtr XMLCALL
227 xmlOutputBufferCreateFilename (const char *URI,
228 xmlCharEncodingHandlerPtr encoder,
231 XMLPUBFUN xmlOutputBufferPtr XMLCALL
232 xmlOutputBufferCreateFile (FILE *file,
233 xmlCharEncodingHandlerPtr encoder);
235 XMLPUBFUN xmlOutputBufferPtr XMLCALL
236 xmlOutputBufferCreateFd (int fd,
237 xmlCharEncodingHandlerPtr encoder);
239 XMLPUBFUN xmlOutputBufferPtr XMLCALL
240 xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
241 xmlOutputCloseCallback ioclose,
243 xmlCharEncodingHandlerPtr encoder);
245 XMLPUBFUN int XMLCALL
246 xmlOutputBufferWrite (xmlOutputBufferPtr out,
249 XMLPUBFUN int XMLCALL
250 xmlOutputBufferWriteString (xmlOutputBufferPtr out,
252 XMLPUBFUN int XMLCALL
253 xmlOutputBufferWriteEscape (xmlOutputBufferPtr out,
255 xmlCharEncodingOutputFunc escaping);
257 XMLPUBFUN int XMLCALL
258 xmlOutputBufferFlush (xmlOutputBufferPtr out);
259 XMLPUBFUN int XMLCALL
260 xmlOutputBufferClose (xmlOutputBufferPtr out);
262 XMLPUBFUN int XMLCALL
263 xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
264 xmlOutputOpenCallback openFunc,
265 xmlOutputWriteCallback writeFunc,
266 xmlOutputCloseCallback closeFunc);
267 #endif /* LIBXML_OUTPUT_ENABLED */
269 /* This function only exists if HTTP support built into the library */
270 #ifdef LIBXML_HTTP_ENABLED
271 XMLPUBFUN void * XMLCALL
272 xmlIOHTTPOpenW (const char * post_uri,
274 XMLPUBFUN void XMLCALL
275 xmlRegisterHTTPPostCallbacks (void );
278 XMLPUBFUN xmlParserInputPtr XMLCALL
279 xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
280 xmlParserInputPtr ret);
283 * A predefined entity loader disabling network accesses
285 XMLPUBFUN xmlParserInputPtr XMLCALL
286 xmlNoNetExternalEntityLoader (const char *URL,
288 xmlParserCtxtPtr ctxt);
290 XMLPUBFUN int XMLCALL
291 xmlCheckFilename (const char *path);
293 * Default 'file://' protocol callbacks
295 XMLPUBFUN int XMLCALL
296 xmlFileMatch (const char *filename);
298 XMLPUBFUN void * XMLCALL
299 xmlFileOpen (const char *filename);
300 XMLPUBFUN int XMLCALL
301 xmlFileRead (void * context,
304 XMLPUBFUN int XMLCALL
305 xmlFileClose (void * context);
308 * Default 'http://' protocol callbacks
310 #ifdef LIBXML_HTTP_ENABLED
311 XMLPUBFUN int XMLCALL
312 xmlIOHTTPMatch (const char *filename);
313 XMLPUBFUN void * XMLCALL
314 xmlIOHTTPOpen (const char *filename);
315 XMLPUBFUN int XMLCALL
316 xmlIOHTTPRead (void * context,
319 XMLPUBFUN int XMLCALL
320 xmlIOHTTPClose (void * context);
321 #endif /* LIBXML_HTTP_ENABLED */
324 * Default 'ftp://' protocol callbacks
326 #ifdef LIBXML_FTP_ENABLED
327 XMLPUBFUN int XMLCALL
328 xmlIOFTPMatch (const char *filename);
329 XMLPUBFUN void * XMLCALL
330 xmlIOFTPOpen (const char *filename);
331 XMLPUBFUN int XMLCALL
332 xmlIOFTPRead (void * context,
335 XMLPUBFUN int XMLCALL
336 xmlIOFTPClose (void * context);
337 #endif /* LIBXML_FTP_ENABLED */
343 #endif /* XML_IO_H */