xmlIO.inc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. * Those are the functions and datatypes for the parser input
  11. * I/O structures.
  12. *)
  13. {$IFDEF POINTER}
  14. xmlParserInputBufferPtr = ^xmlParserInputBuffer;
  15. xmlOutputBufferPtr = ^xmlOutputBuffer;
  16. {$ENDIF}
  17. {$IFDEF TYPE}
  18. (**
  19. * xmlInputMatchCallback:
  20. * @filename: the filename or URI
  21. *
  22. * Callback used in the I/O Input API to detect if the current handler
  23. * can provide input fonctionnalities for this resource.
  24. *
  25. * Returns 1 if yes and 0 if another Input module should be used
  26. *)
  27. xmlInputMatchCallback = function(filename: PAnsiChar): cint; EXTDECL;
  28. (**
  29. * xmlInputOpenCallback:
  30. * @filename: the filename or URI
  31. *
  32. * Callback used in the I/O Input API to open the resource
  33. *
  34. * Returns an Input context or NULL in case or error
  35. *)
  36. xmlInputOpenCallback = function(filename: PAnsiChar): pointer; EXTDECL;
  37. (**
  38. * xmlInputReadCallback:
  39. * @context: an Input context
  40. * @buffer: the buffer to store data read
  41. * @len: the length of the buffer in bytes
  42. *
  43. * Callback used in the I/O Input API to read the resource
  44. *
  45. * Returns the number of bytes read or -1 in case of error
  46. *)
  47. xmlInputReadCallback = function(context: pointer; buffer: PAnsiChar; len: cint): cint; EXTDECL;
  48. (**
  49. * xmlInputCloseCallback:
  50. * @context: an Input context
  51. *
  52. * Callback used in the I/O Input API to close the resource
  53. *
  54. * Returns 0 or -1 in case of error
  55. *)
  56. xmlInputCloseCallback = function(context: pointer): cint; EXTDECL;
  57. {$IFDEF LIBXML_OUTPUT_ENABLED}
  58. (*
  59. * Those are the functions and datatypes for the library output
  60. * I/O structures.
  61. *)
  62. (**
  63. * xmlOutputMatchCallback:
  64. * @filename: the filename or URI
  65. *
  66. * Callback used in the I/O Output API to detect if the current handler
  67. * can provide output fonctionnalities for this resource.
  68. *
  69. * Returns 1 if yes and 0 if another Output module should be used
  70. *)
  71. xmlOutputMatchCallback = function(filename: PAnsiChar): cint; EXTDECL;
  72. (**
  73. * xmlOutputOpenCallback:
  74. * @filename: the filename or URI
  75. *
  76. * Callback used in the I/O Output API to open the resource
  77. *
  78. * Returns an Output context or NULL in case or error
  79. *)
  80. xmlOutputOpenCallback = function(filename: PAnsiChar): pointer; EXTDECL;
  81. (**
  82. * xmlOutputWriteCallback:
  83. * @context: an Output context
  84. * @buffer: the buffer of data to write
  85. * @len: the length of the buffer in bytes
  86. *
  87. * Callback used in the I/O Output API to write to the resource
  88. *
  89. * Returns the number of bytes written or -1 in case of error
  90. *)
  91. xmlOutputWriteCallback = function(context: pointer; buffer: PAnsiChar; len: cint): cint; EXTDECL;
  92. (**
  93. * xmlOutputCloseCallback:
  94. * @context: an Output context
  95. *
  96. * Callback used in the I/O Output API to close the resource
  97. *
  98. * Returns 0 or -1 in case of error
  99. *)
  100. xmlOutputCloseCallback = function(context: pointer): cint; EXTDECL;
  101. {$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
  102. xmlParserInputBuffer = record
  103. context : pointer;
  104. readcallback : xmlInputReadCallback;
  105. closecallback : xmlInputCloseCallback;
  106. encoder : xmlCharEncodingHandlerPtr; (* I18N conversions to UTF-8 *)
  107. buffer : xmlBufferPtr; (* Local buffer encoded in UTF-8 *)
  108. raw : xmlBufferPtr; (* if encoder != NULL buffer for raw input *)
  109. compressed : cint; (* -1=unknown, 0=not compressed, 1=compressed *)
  110. error : cint;
  111. rawconsumed : culong; (* amount consumed from raw *)
  112. end;
  113. {$IFDEF LIBXML_OUTPUT_ENABLED}
  114. xmlOutputBuffer = record
  115. context : pointer;
  116. writecallback : xmlOutputWriteCallback;
  117. closecallback : xmlOutputCloseCallback;
  118. encoder : xmlCharEncodingHandlerPtr; (* I18N conversions to UTF-8 *)
  119. buffer : xmlBufferPtr; (* Local buffer encoded in UTF-8 or ISOLatin *)
  120. conv : xmlBufferPtr; (* if encoder != NULL buffer for output *)
  121. written : cint; (* total number of byte written *)
  122. error : cint;
  123. end;
  124. {$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
  125. {$ENDIF}
  126. {$IFDEF FUNCTION}
  127. (*
  128. * Interfaces for input
  129. *)
  130. procedure xmlCleanupInputCallbacks; EXTDECL; external xml2lib;
  131. function xmlPopInputCallbacks: cint; EXTDECL; external xml2lib;
  132. procedure xmlRegisterDefaultInputCallbacks; EXTDECL; external xml2lib;
  133. function xmlAllocParserInputBuffer(enc: xmlCharEncoding): xmlParserInputBufferPtr; EXTDECL; external xml2lib;
  134. function xmlParserInputBufferCreateFilename(URI: PAnsiChar; enc: xmlCharEncoding): xmlParserInputBufferPtr; EXTDECL; external xml2lib;
  135. function xmlParserInputBufferCreateFile(fp: PFILE; enc: xmlCharEncoding): xmlParserInputBufferPtr; EXTDECL; external xml2lib;
  136. function xmlParserInputBufferCreateFd(fd: cint; enc: xmlCharEncoding): xmlParserInputBufferPtr; EXTDECL; external xml2lib;
  137. function xmlParserInputBufferCreateMem(mem: PAnsiChar; size: cint; enc: xmlCharEncoding): xmlParserInputBufferPtr; EXTDECL; external xml2lib;
  138. function xmlParserInputBufferCreateStatic(mem: PAnsiChar; size: cint; enc: xmlCharEncoding): xmlParserInputBufferPtr; EXTDECL; external xml2lib;
  139. function xmlParserInputBufferCreateIO(ioread: xmlInputReadCallback; ioclose: xmlInputCloseCallback; ioctx: pointer; enc: xmlCharEncoding): xmlParserInputBufferPtr; EXTDECL; external xml2lib;
  140. function xmlParserInputBufferRead(_in: xmlParserInputBufferPtr; len: cint): cint; EXTDECL; external xml2lib;
  141. function xmlParserInputBufferGrow(_in: xmlParserInputBufferPtr; len: cint): cint; EXTDECL; external xml2lib;
  142. function xmlParserInputBufferPush(_in: xmlParserInputBufferPtr; len: cint; buf: PAnsiChar): cint; EXTDECL; external xml2lib;
  143. procedure xmlFreeParserInputBuffer(_in: xmlParserInputBufferPtr); EXTDECL; external xml2lib;
  144. function xmlParserGetDirectory(filename: PAnsiChar): PAnsiChar; EXTDECL; external xml2lib;
  145. function xmlRegisterInputCallbacks(matchFunc: xmlInputMatchCallback; openFunc: xmlInputOpenCallback; readFunc: xmlInputReadCallback; closeFunc: xmlInputCloseCallback): cint; EXTDECL; external xml2lib;
  146. function __xmlParserInputBufferCreateFilename(URI: PAnsiChar; enc: xmlCharEncoding): xmlParserInputBufferPtr; EXTDECL; external xml2lib;
  147. {$IFDEF LIBXML_OUTPUT_ENABLED}
  148. (*
  149. * Interfaces for output
  150. *)
  151. procedure xmlCleanupOutputCallbacks; EXTDECL; external xml2lib;
  152. procedure xmlRegisterDefaultOutputCallbacks; EXTDECL; external xml2lib;
  153. function xmlAllocOutputBuffer(encoder: xmlCharEncodingHandlerPtr): xmlOutputBufferPtr; EXTDECL; external xml2lib;
  154. function xmlOutputBufferCreateFilename(URI: PAnsiChar; encoder: xmlCharEncodingHandlerPtr; compression: cint): xmlOutputBufferPtr; EXTDECL; external xml2lib;
  155. function xmlOutputBufferCreateFile(fp: PFILE; encoder: xmlCharEncodingHandlerPtr): xmlOutputBufferPtr; EXTDECL; external xml2lib;
  156. function xmlOutputBufferCreateBuffer(buffer: xmlBufferPtr; encoder: xmlCharEncodingHandlerPtr): xmlOutputBufferPtr; EXTDECL; external xml2lib;
  157. function xmlOutputBufferCreateFd(fd: cint; encoder: xmlCharEncodingHandlerPtr): xmlOutputBufferPtr; EXTDECL; external xml2lib;
  158. function xmlOutputBufferCreateIO(iowrite: xmlOutputWriteCallback; ioclose: xmlOutputCloseCallback; ioctx: pointer; encoder: xmlCharEncodingHandlerPtr): xmlOutputBufferPtr; EXTDECL; external xml2lib;
  159. function xmlOutputBufferWrite(_out: xmlOutputBufferPtr; len: cint; buf: PAnsiChar): cint; EXTDECL; external xml2lib;
  160. function xmlOutputBufferWriteString(_out: xmlOutputBufferPtr; str: PAnsiChar): cint; EXTDECL; external xml2lib;
  161. function xmlOutputBufferWriteEscape(_out: xmlOutputBufferPtr; str: xmlCharPtr; escaping: xmlCharEncodingOutputFunc): cint; EXTDECL; external xml2lib;
  162. function xmlOutputBufferFlush(_out: xmlOutputBufferPtr): cint; EXTDECL; external xml2lib;
  163. function xmlOutputBufferClose(_out: xmlOutputBufferPtr): cint; EXTDECL; external xml2lib;
  164. function xmlRegisterOutputCallbacks(matchFunc: xmlOutputMatchCallback; openFunc: xmlOutputOpenCallback; writeFunc: xmlOutputWriteCallback; closeFunc: xmlOutputCloseCallback): cint; EXTDECL; external xml2lib;
  165. function __xmlOutputBufferCreateFilename(URI: PAnsiChar; encoder: xmlCharEncodingHandlerPtr; compression: cint): xmlOutputBufferPtr; EXTDECL; external xml2lib;
  166. {$IFDEF LIBXML_HTTP_ENABLED}
  167. (* This function only exists if HTTP support built into the library *)
  168. procedure xmlRegisterHTTPPostCallbacks; EXTDECL; external xml2lib;
  169. {$ENDIF} (* LIBXML_HTTP_ENABLED *)
  170. {$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
  171. function xmlCheckHTTPInput(ctxt: xmlParserCtxtPtr; ret: xmlParserInputPtr): xmlParserInputPtr; EXTDECL; external xml2lib;
  172. (*
  173. * A predefined entity loader disabling network accesses
  174. *)
  175. function xmlNoNetExternalEntityLoader(URL: PAnsiChar; ID: PAnsiChar; ctxt: xmlParserCtxtPtr): xmlParserInputPtr; EXTDECL; external xml2lib;
  176. (*
  177. * Check xmlCanonicPath in uri.h for a better alternative.
  178. *)
  179. function xmlCheckFilename(path: PAnsiChar): cint; EXTDECL; external xml2lib;
  180. (**
  181. * Default 'file://' protocol callbacks
  182. *)
  183. function xmlFileMatch(filename: PAnsiChar): cint; EXTDECL; external xml2lib;
  184. function xmlFileOpen(filename: PAnsiChar): pointer; EXTDECL; external xml2lib;
  185. function xmlFileRead(context: pointer; buffer: PAnsiChar; len: cint): cint; EXTDECL; external xml2lib;
  186. function xmlFileClose(context: pointer): cint; EXTDECL; external xml2lib;
  187. (**
  188. * Default 'http://' protocol callbacks
  189. *)
  190. {$IFDEF LIBXML_HTTP_ENABLED}
  191. function xmlIOHTTPMatch(filename: PAnsiChar): cint; EXTDECL; external xml2lib;
  192. function xmlIOHTTPOpen(filename: PAnsiChar): pointer; EXTDECL; external xml2lib;
  193. {$IFDEF LIBXML_OUTPUT_ENABLED}
  194. function xmlIOHTTPOpenW(post_uri: PAnsiChar; compression: cint): pointer; EXTDECL; external xml2lib;
  195. {$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
  196. function xmlIOHTTPRead(context: pointer; buffer: PAnsiChar; len: cint): cint; EXTDECL; external xml2lib;
  197. function xmlIOHTTPClose(context: pointer): cint; EXTDECL; external xml2lib;
  198. {$ENDIF} (* LIBXML_HTTP_ENABLED *)
  199. (**
  200. * Default 'ftp://' protocol callbacks
  201. *)
  202. {$IFDEF LIBXML_FTP_ENABLED}
  203. function xmlIOFTPMatch(filename: PAnsiChar): cint; EXTDECL; external xml2lib;
  204. function xmlIOFTPOpen(filename: PAnsiChar): pointer; EXTDECL; external xml2lib;
  205. function xmlIOFTPRead(context: pointer; buffer: PAnsiChar; len: cint): cint; EXTDECL; external xml2lib;
  206. function xmlIOFTPClose(context: pointer): cint; EXTDECL; external xml2lib;
  207. {$ENDIF} (* LIBXML_FTP_ENABLED *)
  208. {$ENDIF}