VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/include/libxml/xmlIO.h@ 107935

Last change on this file since 107935 was 105420, checked in by vboxsync, 8 months ago

libxml2-2.12.6: Applied and adjusted our libxml2 changes to 2.12.6. bugref:10730

  • Property svn:eol-style set to native
File size: 12.2 KB
Line 
1/*
2 * Summary: interface for the I/O interfaces used by the parser
3 * Description: interface for the I/O interfaces used by the parser
4 *
5 * Copy: See Copyright for the status of this software.
6 *
7 * Author: Daniel Veillard
8 */
9
10#ifndef __XML_IO_H__
11#define __XML_IO_H__
12
13/** DOC_DISABLE */
14#include <stdio.h>
15#include <libxml/xmlversion.h>
16#include <libxml/encoding.h>
17#define XML_TREE_INTERNALS
18#include <libxml/tree.h>
19#undef XML_TREE_INTERNALS
20/** DOC_ENABLE */
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/*
27 * Those are the functions and datatypes for the parser input
28 * I/O structures.
29 */
30
31/**
32 * xmlInputMatchCallback:
33 * @filename: the filename or URI
34 *
35 * Callback used in the I/O Input API to detect if the current handler
36 * can provide input functionality for this resource.
37 *
38 * Returns 1 if yes and 0 if another Input module should be used
39 */
40typedef int (*xmlInputMatchCallback) (char const *filename);
41/**
42 * xmlInputOpenCallback:
43 * @filename: the filename or URI
44 *
45 * Callback used in the I/O Input API to open the resource
46 *
47 * Returns an Input context or NULL in case or error
48 */
49typedef void * (*xmlInputOpenCallback) (char const *filename);
50/**
51 * xmlInputReadCallback:
52 * @context: an Input context
53 * @buffer: the buffer to store data read
54 * @len: the length of the buffer in bytes
55 *
56 * Callback used in the I/O Input API to read the resource
57 *
58 * Returns the number of bytes read or -1 in case of error
59 */
60typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
61/**
62 * xmlInputCloseCallback:
63 * @context: an Input context
64 *
65 * Callback used in the I/O Input API to close the resource
66 *
67 * Returns 0 or -1 in case of error
68 */
69typedef int (*xmlInputCloseCallback) (void * context);
70
71#ifdef LIBXML_OUTPUT_ENABLED
72/*
73 * Those are the functions and datatypes for the library output
74 * I/O structures.
75 */
76
77/**
78 * xmlOutputMatchCallback:
79 * @filename: the filename or URI
80 *
81 * Callback used in the I/O Output API to detect if the current handler
82 * can provide output functionality for this resource.
83 *
84 * Returns 1 if yes and 0 if another Output module should be used
85 */
86typedef int (*xmlOutputMatchCallback) (char const *filename);
87/**
88 * xmlOutputOpenCallback:
89 * @filename: the filename or URI
90 *
91 * Callback used in the I/O Output API to open the resource
92 *
93 * Returns an Output context or NULL in case or error
94 */
95typedef void * (*xmlOutputOpenCallback) (char const *filename);
96/**
97 * xmlOutputWriteCallback:
98 * @context: an Output context
99 * @buffer: the buffer of data to write
100 * @len: the length of the buffer in bytes
101 *
102 * Callback used in the I/O Output API to write to the resource
103 *
104 * Returns the number of bytes written or -1 in case of error
105 */
106typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
107 int len);
108/**
109 * xmlOutputCloseCallback:
110 * @context: an Output context
111 *
112 * Callback used in the I/O Output API to close the resource
113 *
114 * Returns 0 or -1 in case of error
115 */
116typedef int (*xmlOutputCloseCallback) (void * context);
117#endif /* LIBXML_OUTPUT_ENABLED */
118
119/**
120 * xmlParserInputBufferCreateFilenameFunc:
121 * @URI: the URI to read from
122 * @enc: the requested source encoding
123 *
124 * Signature for the function doing the lookup for a suitable input method
125 * corresponding to an URI.
126 *
127 * Returns the new xmlParserInputBufferPtr in case of success or NULL if no
128 * method was found.
129 */
130typedef xmlParserInputBufferPtr
131(*xmlParserInputBufferCreateFilenameFunc)(const char *URI, xmlCharEncoding enc);
132
133/**
134 * xmlOutputBufferCreateFilenameFunc:
135 * @URI: the URI to write to
136 * @enc: the requested target encoding
137 *
138 * Signature for the function doing the lookup for a suitable output method
139 * corresponding to an URI.
140 *
141 * Returns the new xmlOutputBufferPtr in case of success or NULL if no
142 * method was found.
143 */
144typedef xmlOutputBufferPtr
145(*xmlOutputBufferCreateFilenameFunc)(const char *URI,
146 xmlCharEncodingHandlerPtr encoder, int compression);
147
148struct _xmlParserInputBuffer {
149 void* context;
150 xmlInputReadCallback readcallback;
151 xmlInputCloseCallback closecallback;
152
153 xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
154
155 xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */
156 xmlBufPtr raw; /* if encoder != NULL buffer for raw input */
157 int compressed; /* -1=unknown, 0=not compressed, 1=compressed */
158 int error;
159 unsigned long rawconsumed;/* amount consumed from raw */
160};
161
162
163#ifdef LIBXML_OUTPUT_ENABLED
164struct _xmlOutputBuffer {
165 void* context;
166 xmlOutputWriteCallback writecallback;
167 xmlOutputCloseCallback closecallback;
168
169 xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
170
171 xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */
172 xmlBufPtr conv; /* if encoder != NULL buffer for output */
173 int written; /* total number of byte written */
174 int error;
175};
176#endif /* LIBXML_OUTPUT_ENABLED */
177
178/** DOC_DISABLE */
179#define XML_GLOBALS_IO \
180 XML_OP(xmlParserInputBufferCreateFilenameValue, \
181 xmlParserInputBufferCreateFilenameFunc, XML_DEPRECATED) \
182 XML_OP(xmlOutputBufferCreateFilenameValue, \
183 xmlOutputBufferCreateFilenameFunc, XML_DEPRECATED)
184
185#define XML_OP XML_DECLARE_GLOBAL
186XML_GLOBALS_IO
187#undef XML_OP
188
189#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION)
190 #define xmlParserInputBufferCreateFilenameValue \
191 XML_GLOBAL_MACRO(xmlParserInputBufferCreateFilenameValue)
192 #define xmlOutputBufferCreateFilenameValue \
193 XML_GLOBAL_MACRO(xmlOutputBufferCreateFilenameValue)
194#endif
195/** DOC_ENABLE */
196
197/*
198 * Interfaces for input
199 */
200XMLPUBFUN void
201 xmlCleanupInputCallbacks (void);
202
203XMLPUBFUN int
204 xmlPopInputCallbacks (void);
205
206XMLPUBFUN void
207 xmlRegisterDefaultInputCallbacks (void);
208XMLPUBFUN xmlParserInputBufferPtr
209 xmlAllocParserInputBuffer (xmlCharEncoding enc);
210
211XMLPUBFUN xmlParserInputBufferPtr
212 xmlParserInputBufferCreateFilename (const char *URI,
213 xmlCharEncoding enc);
214XMLPUBFUN xmlParserInputBufferPtr
215 xmlParserInputBufferCreateFile (FILE *file,
216 xmlCharEncoding enc);
217XMLPUBFUN xmlParserInputBufferPtr
218 xmlParserInputBufferCreateFd (int fd,
219 xmlCharEncoding enc);
220XMLPUBFUN xmlParserInputBufferPtr
221 xmlParserInputBufferCreateMem (const char *mem, int size,
222 xmlCharEncoding enc);
223XMLPUBFUN xmlParserInputBufferPtr
224 xmlParserInputBufferCreateStatic (const char *mem, int size,
225 xmlCharEncoding enc);
226XMLPUBFUN xmlParserInputBufferPtr
227 xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
228 xmlInputCloseCallback ioclose,
229 void *ioctx,
230 xmlCharEncoding enc);
231XMLPUBFUN int
232 xmlParserInputBufferRead (xmlParserInputBufferPtr in,
233 int len);
234XMLPUBFUN int
235 xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
236 int len);
237XMLPUBFUN int
238 xmlParserInputBufferPush (xmlParserInputBufferPtr in,
239 int len,
240 const char *buf);
241XMLPUBFUN void
242 xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
243XMLPUBFUN char *
244 xmlParserGetDirectory (const char *filename);
245
246XMLPUBFUN int
247 xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
248 xmlInputOpenCallback openFunc,
249 xmlInputReadCallback readFunc,
250 xmlInputCloseCallback closeFunc);
251
252xmlParserInputBufferPtr
253 __xmlParserInputBufferCreateFilename(const char *URI,
254 xmlCharEncoding enc);
255
256#ifdef LIBXML_OUTPUT_ENABLED
257/*
258 * Interfaces for output
259 */
260XMLPUBFUN void
261 xmlCleanupOutputCallbacks (void);
262XMLPUBFUN int
263 xmlPopOutputCallbacks (void);
264XMLPUBFUN void
265 xmlRegisterDefaultOutputCallbacks(void);
266XMLPUBFUN xmlOutputBufferPtr
267 xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
268
269XMLPUBFUN xmlOutputBufferPtr
270 xmlOutputBufferCreateFilename (const char *URI,
271 xmlCharEncodingHandlerPtr encoder,
272 int compression);
273
274XMLPUBFUN xmlOutputBufferPtr
275 xmlOutputBufferCreateFile (FILE *file,
276 xmlCharEncodingHandlerPtr encoder);
277
278XMLPUBFUN xmlOutputBufferPtr
279 xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
280 xmlCharEncodingHandlerPtr encoder);
281
282XMLPUBFUN xmlOutputBufferPtr
283 xmlOutputBufferCreateFd (int fd,
284 xmlCharEncodingHandlerPtr encoder);
285
286XMLPUBFUN xmlOutputBufferPtr
287 xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
288 xmlOutputCloseCallback ioclose,
289 void *ioctx,
290 xmlCharEncodingHandlerPtr encoder);
291
292/* Couple of APIs to get the output without digging into the buffers */
293XMLPUBFUN const xmlChar *
294 xmlOutputBufferGetContent (xmlOutputBufferPtr out);
295XMLPUBFUN size_t
296 xmlOutputBufferGetSize (xmlOutputBufferPtr out);
297
298XMLPUBFUN int
299 xmlOutputBufferWrite (xmlOutputBufferPtr out,
300 int len,
301 const char *buf);
302XMLPUBFUN int
303 xmlOutputBufferWriteString (xmlOutputBufferPtr out,
304 const char *str);
305XMLPUBFUN int
306 xmlOutputBufferWriteEscape (xmlOutputBufferPtr out,
307 const xmlChar *str,
308 xmlCharEncodingOutputFunc escaping);
309
310XMLPUBFUN int
311 xmlOutputBufferFlush (xmlOutputBufferPtr out);
312XMLPUBFUN int
313 xmlOutputBufferClose (xmlOutputBufferPtr out);
314
315XMLPUBFUN int
316 xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
317 xmlOutputOpenCallback openFunc,
318 xmlOutputWriteCallback writeFunc,
319 xmlOutputCloseCallback closeFunc);
320
321xmlOutputBufferPtr
322 __xmlOutputBufferCreateFilename(const char *URI,
323 xmlCharEncodingHandlerPtr encoder,
324 int compression);
325
326#ifdef LIBXML_HTTP_ENABLED
327/* This function only exists if HTTP support built into the library */
328XML_DEPRECATED
329XMLPUBFUN void
330 xmlRegisterHTTPPostCallbacks (void );
331#endif /* LIBXML_HTTP_ENABLED */
332
333#endif /* LIBXML_OUTPUT_ENABLED */
334
335XML_DEPRECATED
336XMLPUBFUN xmlParserInputPtr
337 xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
338 xmlParserInputPtr ret);
339
340/*
341 * A predefined entity loader disabling network accesses
342 */
343XMLPUBFUN xmlParserInputPtr
344 xmlNoNetExternalEntityLoader (const char *URL,
345 const char *ID,
346 xmlParserCtxtPtr ctxt);
347
348XML_DEPRECATED
349XMLPUBFUN xmlChar *
350 xmlNormalizeWindowsPath (const xmlChar *path);
351
352XML_DEPRECATED
353XMLPUBFUN int
354 xmlCheckFilename (const char *path);
355/**
356 * Default 'file://' protocol callbacks
357 */
358XML_DEPRECATED
359XMLPUBFUN int
360 xmlFileMatch (const char *filename);
361XML_DEPRECATED
362XMLPUBFUN void *
363 xmlFileOpen (const char *filename);
364XML_DEPRECATED
365XMLPUBFUN int
366 xmlFileRead (void * context,
367 char * buffer,
368 int len);
369XML_DEPRECATED
370XMLPUBFUN int
371 xmlFileClose (void * context);
372
373/**
374 * Default 'http://' protocol callbacks
375 */
376#ifdef LIBXML_HTTP_ENABLED
377XML_DEPRECATED
378XMLPUBFUN int
379 xmlIOHTTPMatch (const char *filename);
380XML_DEPRECATED
381XMLPUBFUN void *
382 xmlIOHTTPOpen (const char *filename);
383#ifdef LIBXML_OUTPUT_ENABLED
384XML_DEPRECATED
385XMLPUBFUN void *
386 xmlIOHTTPOpenW (const char * post_uri,
387 int compression );
388#endif /* LIBXML_OUTPUT_ENABLED */
389XML_DEPRECATED
390XMLPUBFUN int
391 xmlIOHTTPRead (void * context,
392 char * buffer,
393 int len);
394XML_DEPRECATED
395XMLPUBFUN int
396 xmlIOHTTPClose (void * context);
397#endif /* LIBXML_HTTP_ENABLED */
398
399/**
400 * Default 'ftp://' protocol callbacks
401 */
402#if defined(LIBXML_FTP_ENABLED)
403XML_DEPRECATED
404XMLPUBFUN int
405 xmlIOFTPMatch (const char *filename);
406XML_DEPRECATED
407XMLPUBFUN void *
408 xmlIOFTPOpen (const char *filename);
409XML_DEPRECATED
410XMLPUBFUN int
411 xmlIOFTPRead (void * context,
412 char * buffer,
413 int len);
414XML_DEPRECATED
415XMLPUBFUN int
416 xmlIOFTPClose (void * context);
417#endif /* defined(LIBXML_FTP_ENABLED) */
418
419XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
420 xmlParserInputBufferCreateFilenameDefault(
421 xmlParserInputBufferCreateFilenameFunc func);
422XMLPUBFUN xmlOutputBufferCreateFilenameFunc
423 xmlOutputBufferCreateFilenameDefault(
424 xmlOutputBufferCreateFilenameFunc func);
425XML_DEPRECATED
426XMLPUBFUN xmlOutputBufferCreateFilenameFunc
427 xmlThrDefOutputBufferCreateFilenameDefault(
428 xmlOutputBufferCreateFilenameFunc func);
429XML_DEPRECATED
430XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
431 xmlThrDefParserInputBufferCreateFilenameDefault(
432 xmlParserInputBufferCreateFilenameFunc func);
433
434#ifdef __cplusplus
435}
436#endif
437
438#endif /* __XML_IO_H__ */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette