nokogiri 1.18.0.rc1-x86_64-linux-gnu

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +38 -0
  3. data/LICENSE-DEPENDENCIES.md +2224 -0
  4. data/LICENSE.md +9 -0
  5. data/README.md +293 -0
  6. data/bin/nokogiri +131 -0
  7. data/dependencies.yml +42 -0
  8. data/ext/nokogiri/depend +38 -0
  9. data/ext/nokogiri/extconf.rb +1173 -0
  10. data/ext/nokogiri/gumbo.c +610 -0
  11. data/ext/nokogiri/html4_document.c +171 -0
  12. data/ext/nokogiri/html4_element_description.c +299 -0
  13. data/ext/nokogiri/html4_entity_lookup.c +37 -0
  14. data/ext/nokogiri/html4_sax_parser.c +40 -0
  15. data/ext/nokogiri/html4_sax_parser_context.c +98 -0
  16. data/ext/nokogiri/html4_sax_push_parser.c +96 -0
  17. data/ext/nokogiri/include/libexslt/exslt.h +108 -0
  18. data/ext/nokogiri/include/libexslt/exsltconfig.h +70 -0
  19. data/ext/nokogiri/include/libexslt/exsltexports.h +63 -0
  20. data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +336 -0
  21. data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +147 -0
  22. data/ext/nokogiri/include/libxml2/libxml/SAX.h +202 -0
  23. data/ext/nokogiri/include/libxml2/libxml/SAX2.h +171 -0
  24. data/ext/nokogiri/include/libxml2/libxml/c14n.h +115 -0
  25. data/ext/nokogiri/include/libxml2/libxml/catalog.h +182 -0
  26. data/ext/nokogiri/include/libxml2/libxml/chvalid.h +230 -0
  27. data/ext/nokogiri/include/libxml2/libxml/debugXML.h +217 -0
  28. data/ext/nokogiri/include/libxml2/libxml/dict.h +82 -0
  29. data/ext/nokogiri/include/libxml2/libxml/encoding.h +244 -0
  30. data/ext/nokogiri/include/libxml2/libxml/entities.h +166 -0
  31. data/ext/nokogiri/include/libxml2/libxml/globals.h +41 -0
  32. data/ext/nokogiri/include/libxml2/libxml/hash.h +251 -0
  33. data/ext/nokogiri/include/libxml2/libxml/list.h +137 -0
  34. data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +186 -0
  35. data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +98 -0
  36. data/ext/nokogiri/include/libxml2/libxml/parser.h +1390 -0
  37. data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +671 -0
  38. data/ext/nokogiri/include/libxml2/libxml/pattern.h +106 -0
  39. data/ext/nokogiri/include/libxml2/libxml/relaxng.h +219 -0
  40. data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +959 -0
  41. data/ext/nokogiri/include/libxml2/libxml/schematron.h +143 -0
  42. data/ext/nokogiri/include/libxml2/libxml/threads.h +87 -0
  43. data/ext/nokogiri/include/libxml2/libxml/tree.h +1382 -0
  44. data/ext/nokogiri/include/libxml2/libxml/uri.h +106 -0
  45. data/ext/nokogiri/include/libxml2/libxml/valid.h +477 -0
  46. data/ext/nokogiri/include/libxml2/libxml/xinclude.h +136 -0
  47. data/ext/nokogiri/include/libxml2/libxml/xlink.h +189 -0
  48. data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +438 -0
  49. data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
  50. data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +962 -0
  51. data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +146 -0
  52. data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +188 -0
  53. data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +57 -0
  54. data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +436 -0
  55. data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +215 -0
  56. data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +102 -0
  57. data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +249 -0
  58. data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +152 -0
  59. data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +140 -0
  60. data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +366 -0
  61. data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +347 -0
  62. data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +489 -0
  63. data/ext/nokogiri/include/libxml2/libxml/xpath.h +579 -0
  64. data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +633 -0
  65. data/ext/nokogiri/include/libxml2/libxml/xpointer.h +138 -0
  66. data/ext/nokogiri/include/libxslt/attributes.h +39 -0
  67. data/ext/nokogiri/include/libxslt/documents.h +93 -0
  68. data/ext/nokogiri/include/libxslt/extensions.h +262 -0
  69. data/ext/nokogiri/include/libxslt/extra.h +72 -0
  70. data/ext/nokogiri/include/libxslt/functions.h +78 -0
  71. data/ext/nokogiri/include/libxslt/imports.h +75 -0
  72. data/ext/nokogiri/include/libxslt/keys.h +53 -0
  73. data/ext/nokogiri/include/libxslt/namespaces.h +68 -0
  74. data/ext/nokogiri/include/libxslt/numbersInternals.h +73 -0
  75. data/ext/nokogiri/include/libxslt/pattern.h +84 -0
  76. data/ext/nokogiri/include/libxslt/preproc.h +43 -0
  77. data/ext/nokogiri/include/libxslt/security.h +104 -0
  78. data/ext/nokogiri/include/libxslt/templates.h +77 -0
  79. data/ext/nokogiri/include/libxslt/transform.h +207 -0
  80. data/ext/nokogiri/include/libxslt/variables.h +118 -0
  81. data/ext/nokogiri/include/libxslt/xslt.h +110 -0
  82. data/ext/nokogiri/include/libxslt/xsltInternals.h +1995 -0
  83. data/ext/nokogiri/include/libxslt/xsltconfig.h +146 -0
  84. data/ext/nokogiri/include/libxslt/xsltexports.h +64 -0
  85. data/ext/nokogiri/include/libxslt/xsltlocale.h +44 -0
  86. data/ext/nokogiri/include/libxslt/xsltutils.h +343 -0
  87. data/ext/nokogiri/libxml2_polyfill.c +114 -0
  88. data/ext/nokogiri/nokogiri.c +294 -0
  89. data/ext/nokogiri/nokogiri.h +238 -0
  90. data/ext/nokogiri/test_global_handlers.c +40 -0
  91. data/ext/nokogiri/xml_attr.c +103 -0
  92. data/ext/nokogiri/xml_attribute_decl.c +70 -0
  93. data/ext/nokogiri/xml_cdata.c +62 -0
  94. data/ext/nokogiri/xml_comment.c +57 -0
  95. data/ext/nokogiri/xml_document.c +784 -0
  96. data/ext/nokogiri/xml_document_fragment.c +29 -0
  97. data/ext/nokogiri/xml_dtd.c +208 -0
  98. data/ext/nokogiri/xml_element_content.c +131 -0
  99. data/ext/nokogiri/xml_element_decl.c +69 -0
  100. data/ext/nokogiri/xml_encoding_handler.c +112 -0
  101. data/ext/nokogiri/xml_entity_decl.c +112 -0
  102. data/ext/nokogiri/xml_entity_reference.c +50 -0
  103. data/ext/nokogiri/xml_namespace.c +181 -0
  104. data/ext/nokogiri/xml_node.c +2459 -0
  105. data/ext/nokogiri/xml_node_set.c +518 -0
  106. data/ext/nokogiri/xml_processing_instruction.c +54 -0
  107. data/ext/nokogiri/xml_reader.c +777 -0
  108. data/ext/nokogiri/xml_relax_ng.c +149 -0
  109. data/ext/nokogiri/xml_sax_parser.c +403 -0
  110. data/ext/nokogiri/xml_sax_parser_context.c +390 -0
  111. data/ext/nokogiri/xml_sax_push_parser.c +206 -0
  112. data/ext/nokogiri/xml_schema.c +226 -0
  113. data/ext/nokogiri/xml_syntax_error.c +93 -0
  114. data/ext/nokogiri/xml_text.c +59 -0
  115. data/ext/nokogiri/xml_xpath_context.c +502 -0
  116. data/ext/nokogiri/xslt_stylesheet.c +421 -0
  117. data/gumbo-parser/CHANGES.md +63 -0
  118. data/gumbo-parser/Makefile +129 -0
  119. data/gumbo-parser/THANKS +27 -0
  120. data/lib/nokogiri/3.1/nokogiri.so +0 -0
  121. data/lib/nokogiri/3.2/nokogiri.so +0 -0
  122. data/lib/nokogiri/3.3/nokogiri.so +0 -0
  123. data/lib/nokogiri/3.4/nokogiri.so +0 -0
  124. data/lib/nokogiri/class_resolver.rb +67 -0
  125. data/lib/nokogiri/css/node.rb +58 -0
  126. data/lib/nokogiri/css/parser.rb +772 -0
  127. data/lib/nokogiri/css/parser.y +277 -0
  128. data/lib/nokogiri/css/parser_extras.rb +36 -0
  129. data/lib/nokogiri/css/selector_cache.rb +38 -0
  130. data/lib/nokogiri/css/syntax_error.rb +9 -0
  131. data/lib/nokogiri/css/tokenizer.rb +155 -0
  132. data/lib/nokogiri/css/tokenizer.rex +57 -0
  133. data/lib/nokogiri/css/xpath_visitor.rb +375 -0
  134. data/lib/nokogiri/css.rb +132 -0
  135. data/lib/nokogiri/decorators/slop.rb +42 -0
  136. data/lib/nokogiri/encoding_handler.rb +57 -0
  137. data/lib/nokogiri/extension.rb +32 -0
  138. data/lib/nokogiri/gumbo.rb +15 -0
  139. data/lib/nokogiri/html.rb +48 -0
  140. data/lib/nokogiri/html4/builder.rb +37 -0
  141. data/lib/nokogiri/html4/document.rb +235 -0
  142. data/lib/nokogiri/html4/document_fragment.rb +166 -0
  143. data/lib/nokogiri/html4/element_description.rb +25 -0
  144. data/lib/nokogiri/html4/element_description_defaults.rb +2040 -0
  145. data/lib/nokogiri/html4/encoding_reader.rb +121 -0
  146. data/lib/nokogiri/html4/entity_lookup.rb +15 -0
  147. data/lib/nokogiri/html4/sax/parser.rb +48 -0
  148. data/lib/nokogiri/html4/sax/parser_context.rb +15 -0
  149. data/lib/nokogiri/html4/sax/push_parser.rb +37 -0
  150. data/lib/nokogiri/html4.rb +42 -0
  151. data/lib/nokogiri/html5/builder.rb +40 -0
  152. data/lib/nokogiri/html5/document.rb +199 -0
  153. data/lib/nokogiri/html5/document_fragment.rb +200 -0
  154. data/lib/nokogiri/html5/node.rb +103 -0
  155. data/lib/nokogiri/html5.rb +368 -0
  156. data/lib/nokogiri/jruby/dependencies.rb +3 -0
  157. data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
  158. data/lib/nokogiri/syntax_error.rb +6 -0
  159. data/lib/nokogiri/version/constant.rb +6 -0
  160. data/lib/nokogiri/version/info.rb +224 -0
  161. data/lib/nokogiri/version.rb +4 -0
  162. data/lib/nokogiri/xml/attr.rb +66 -0
  163. data/lib/nokogiri/xml/attribute_decl.rb +22 -0
  164. data/lib/nokogiri/xml/builder.rb +494 -0
  165. data/lib/nokogiri/xml/cdata.rb +13 -0
  166. data/lib/nokogiri/xml/character_data.rb +9 -0
  167. data/lib/nokogiri/xml/document.rb +514 -0
  168. data/lib/nokogiri/xml/document_fragment.rb +276 -0
  169. data/lib/nokogiri/xml/dtd.rb +34 -0
  170. data/lib/nokogiri/xml/element_content.rb +46 -0
  171. data/lib/nokogiri/xml/element_decl.rb +17 -0
  172. data/lib/nokogiri/xml/entity_decl.rb +23 -0
  173. data/lib/nokogiri/xml/entity_reference.rb +20 -0
  174. data/lib/nokogiri/xml/namespace.rb +57 -0
  175. data/lib/nokogiri/xml/node/save_options.rb +76 -0
  176. data/lib/nokogiri/xml/node.rb +1650 -0
  177. data/lib/nokogiri/xml/node_set.rb +449 -0
  178. data/lib/nokogiri/xml/notation.rb +19 -0
  179. data/lib/nokogiri/xml/parse_options.rb +213 -0
  180. data/lib/nokogiri/xml/pp/character_data.rb +21 -0
  181. data/lib/nokogiri/xml/pp/node.rb +73 -0
  182. data/lib/nokogiri/xml/pp.rb +4 -0
  183. data/lib/nokogiri/xml/processing_instruction.rb +11 -0
  184. data/lib/nokogiri/xml/reader.rb +139 -0
  185. data/lib/nokogiri/xml/relax_ng.rb +75 -0
  186. data/lib/nokogiri/xml/sax/document.rb +258 -0
  187. data/lib/nokogiri/xml/sax/parser.rb +199 -0
  188. data/lib/nokogiri/xml/sax/parser_context.rb +129 -0
  189. data/lib/nokogiri/xml/sax/push_parser.rb +64 -0
  190. data/lib/nokogiri/xml/sax.rb +54 -0
  191. data/lib/nokogiri/xml/schema.rb +140 -0
  192. data/lib/nokogiri/xml/searchable.rb +297 -0
  193. data/lib/nokogiri/xml/syntax_error.rb +94 -0
  194. data/lib/nokogiri/xml/text.rb +11 -0
  195. data/lib/nokogiri/xml/xpath/syntax_error.rb +13 -0
  196. data/lib/nokogiri/xml/xpath.rb +21 -0
  197. data/lib/nokogiri/xml/xpath_context.rb +49 -0
  198. data/lib/nokogiri/xml.rb +65 -0
  199. data/lib/nokogiri/xslt/stylesheet.rb +49 -0
  200. data/lib/nokogiri/xslt.rb +129 -0
  201. data/lib/nokogiri.rb +128 -0
  202. data/lib/xsd/xmlparser/nokogiri.rb +105 -0
  203. metadata +324 -0
@@ -0,0 +1,189 @@
1
+ /*
2
+ * Summary: unfinished XLink detection module
3
+ * Description: unfinished XLink detection module
4
+ *
5
+ * Copy: See Copyright for the status of this software.
6
+ *
7
+ * Author: Daniel Veillard
8
+ */
9
+
10
+ #ifndef __XML_XLINK_H__
11
+ #define __XML_XLINK_H__
12
+
13
+ #include <libxml/xmlversion.h>
14
+ #include <libxml/tree.h>
15
+
16
+ #ifdef LIBXML_XPTR_ENABLED
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ /**
23
+ * Various defines for the various Link properties.
24
+ *
25
+ * NOTE: the link detection layer will try to resolve QName expansion
26
+ * of namespaces. If "foo" is the prefix for "http://foo.com/"
27
+ * then the link detection layer will expand role="foo:myrole"
28
+ * to "http://foo.com/:myrole".
29
+ * NOTE: the link detection layer will expand URI-References found on
30
+ * href attributes by using the base mechanism if found.
31
+ */
32
+ typedef xmlChar *xlinkHRef;
33
+ typedef xmlChar *xlinkRole;
34
+ typedef xmlChar *xlinkTitle;
35
+
36
+ typedef enum {
37
+ XLINK_TYPE_NONE = 0,
38
+ XLINK_TYPE_SIMPLE,
39
+ XLINK_TYPE_EXTENDED,
40
+ XLINK_TYPE_EXTENDED_SET
41
+ } xlinkType;
42
+
43
+ typedef enum {
44
+ XLINK_SHOW_NONE = 0,
45
+ XLINK_SHOW_NEW,
46
+ XLINK_SHOW_EMBED,
47
+ XLINK_SHOW_REPLACE
48
+ } xlinkShow;
49
+
50
+ typedef enum {
51
+ XLINK_ACTUATE_NONE = 0,
52
+ XLINK_ACTUATE_AUTO,
53
+ XLINK_ACTUATE_ONREQUEST
54
+ } xlinkActuate;
55
+
56
+ /**
57
+ * xlinkNodeDetectFunc:
58
+ * @ctx: user data pointer
59
+ * @node: the node to check
60
+ *
61
+ * This is the prototype for the link detection routine.
62
+ * It calls the default link detection callbacks upon link detection.
63
+ */
64
+ typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
65
+
66
+ /*
67
+ * The link detection module interact with the upper layers using
68
+ * a set of callback registered at parsing time.
69
+ */
70
+
71
+ /**
72
+ * xlinkSimpleLinkFunk:
73
+ * @ctx: user data pointer
74
+ * @node: the node carrying the link
75
+ * @href: the target of the link
76
+ * @role: the role string
77
+ * @title: the link title
78
+ *
79
+ * This is the prototype for a simple link detection callback.
80
+ */
81
+ typedef void
82
+ (*xlinkSimpleLinkFunk) (void *ctx,
83
+ xmlNodePtr node,
84
+ const xlinkHRef href,
85
+ const xlinkRole role,
86
+ const xlinkTitle title);
87
+
88
+ /**
89
+ * xlinkExtendedLinkFunk:
90
+ * @ctx: user data pointer
91
+ * @node: the node carrying the link
92
+ * @nbLocators: the number of locators detected on the link
93
+ * @hrefs: pointer to the array of locator hrefs
94
+ * @roles: pointer to the array of locator roles
95
+ * @nbArcs: the number of arcs detected on the link
96
+ * @from: pointer to the array of source roles found on the arcs
97
+ * @to: pointer to the array of target roles found on the arcs
98
+ * @show: array of values for the show attributes found on the arcs
99
+ * @actuate: array of values for the actuate attributes found on the arcs
100
+ * @nbTitles: the number of titles detected on the link
101
+ * @title: array of titles detected on the link
102
+ * @langs: array of xml:lang values for the titles
103
+ *
104
+ * This is the prototype for a extended link detection callback.
105
+ */
106
+ typedef void
107
+ (*xlinkExtendedLinkFunk)(void *ctx,
108
+ xmlNodePtr node,
109
+ int nbLocators,
110
+ const xlinkHRef *hrefs,
111
+ const xlinkRole *roles,
112
+ int nbArcs,
113
+ const xlinkRole *from,
114
+ const xlinkRole *to,
115
+ xlinkShow *show,
116
+ xlinkActuate *actuate,
117
+ int nbTitles,
118
+ const xlinkTitle *titles,
119
+ const xmlChar **langs);
120
+
121
+ /**
122
+ * xlinkExtendedLinkSetFunk:
123
+ * @ctx: user data pointer
124
+ * @node: the node carrying the link
125
+ * @nbLocators: the number of locators detected on the link
126
+ * @hrefs: pointer to the array of locator hrefs
127
+ * @roles: pointer to the array of locator roles
128
+ * @nbTitles: the number of titles detected on the link
129
+ * @title: array of titles detected on the link
130
+ * @langs: array of xml:lang values for the titles
131
+ *
132
+ * This is the prototype for a extended link set detection callback.
133
+ */
134
+ typedef void
135
+ (*xlinkExtendedLinkSetFunk) (void *ctx,
136
+ xmlNodePtr node,
137
+ int nbLocators,
138
+ const xlinkHRef *hrefs,
139
+ const xlinkRole *roles,
140
+ int nbTitles,
141
+ const xlinkTitle *titles,
142
+ const xmlChar **langs);
143
+
144
+ /**
145
+ * This is the structure containing a set of Links detection callbacks.
146
+ *
147
+ * There is no default xlink callbacks, if one want to get link
148
+ * recognition activated, those call backs must be provided before parsing.
149
+ */
150
+ typedef struct _xlinkHandler xlinkHandler;
151
+ typedef xlinkHandler *xlinkHandlerPtr;
152
+ struct _xlinkHandler {
153
+ xlinkSimpleLinkFunk simple;
154
+ xlinkExtendedLinkFunk extended;
155
+ xlinkExtendedLinkSetFunk set;
156
+ };
157
+
158
+ /*
159
+ * The default detection routine, can be overridden, they call the default
160
+ * detection callbacks.
161
+ */
162
+
163
+ XMLPUBFUN xlinkNodeDetectFunc
164
+ xlinkGetDefaultDetect (void);
165
+ XMLPUBFUN void
166
+ xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
167
+
168
+ /*
169
+ * Routines to set/get the default handlers.
170
+ */
171
+ XMLPUBFUN xlinkHandlerPtr
172
+ xlinkGetDefaultHandler (void);
173
+ XMLPUBFUN void
174
+ xlinkSetDefaultHandler (xlinkHandlerPtr handler);
175
+
176
+ /*
177
+ * Link detection module itself.
178
+ */
179
+ XMLPUBFUN xlinkType
180
+ xlinkIsLink (xmlDocPtr doc,
181
+ xmlNodePtr node);
182
+
183
+ #ifdef __cplusplus
184
+ }
185
+ #endif
186
+
187
+ #endif /* LIBXML_XPTR_ENABLED */
188
+
189
+ #endif /* __XML_XLINK_H__ */
@@ -0,0 +1,438 @@
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
23
+ extern "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
+ */
40
+ typedef 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
+ */
49
+ typedef 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
+ */
60
+ typedef 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
+ */
69
+ typedef 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
+ */
86
+ typedef 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
+ */
95
+ typedef 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
+ */
106
+ typedef 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
+ */
116
+ typedef 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
+ */
130
+ typedef 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
+ */
144
+ typedef xmlOutputBufferPtr
145
+ (*xmlOutputBufferCreateFilenameFunc)(const char *URI,
146
+ xmlCharEncodingHandlerPtr encoder, int compression);
147
+
148
+ struct _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
164
+ struct _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
186
+ XML_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
+ */
200
+ XMLPUBFUN void
201
+ xmlCleanupInputCallbacks (void);
202
+
203
+ XMLPUBFUN int
204
+ xmlPopInputCallbacks (void);
205
+
206
+ XMLPUBFUN void
207
+ xmlRegisterDefaultInputCallbacks (void);
208
+ XMLPUBFUN xmlParserInputBufferPtr
209
+ xmlAllocParserInputBuffer (xmlCharEncoding enc);
210
+
211
+ XMLPUBFUN xmlParserInputBufferPtr
212
+ xmlParserInputBufferCreateFilename (const char *URI,
213
+ xmlCharEncoding enc);
214
+ XMLPUBFUN xmlParserInputBufferPtr
215
+ xmlParserInputBufferCreateFile (FILE *file,
216
+ xmlCharEncoding enc);
217
+ XMLPUBFUN xmlParserInputBufferPtr
218
+ xmlParserInputBufferCreateFd (int fd,
219
+ xmlCharEncoding enc);
220
+ XMLPUBFUN xmlParserInputBufferPtr
221
+ xmlParserInputBufferCreateMem (const char *mem, int size,
222
+ xmlCharEncoding enc);
223
+ XMLPUBFUN xmlParserInputBufferPtr
224
+ xmlParserInputBufferCreateStatic (const char *mem, int size,
225
+ xmlCharEncoding enc);
226
+ XMLPUBFUN xmlParserInputBufferPtr
227
+ xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
228
+ xmlInputCloseCallback ioclose,
229
+ void *ioctx,
230
+ xmlCharEncoding enc);
231
+ XMLPUBFUN int
232
+ xmlParserInputBufferRead (xmlParserInputBufferPtr in,
233
+ int len);
234
+ XMLPUBFUN int
235
+ xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
236
+ int len);
237
+ XMLPUBFUN int
238
+ xmlParserInputBufferPush (xmlParserInputBufferPtr in,
239
+ int len,
240
+ const char *buf);
241
+ XMLPUBFUN void
242
+ xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
243
+ XMLPUBFUN char *
244
+ xmlParserGetDirectory (const char *filename);
245
+
246
+ XMLPUBFUN int
247
+ xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
248
+ xmlInputOpenCallback openFunc,
249
+ xmlInputReadCallback readFunc,
250
+ xmlInputCloseCallback closeFunc);
251
+
252
+ xmlParserInputBufferPtr
253
+ __xmlParserInputBufferCreateFilename(const char *URI,
254
+ xmlCharEncoding enc);
255
+
256
+ #ifdef LIBXML_OUTPUT_ENABLED
257
+ /*
258
+ * Interfaces for output
259
+ */
260
+ XMLPUBFUN void
261
+ xmlCleanupOutputCallbacks (void);
262
+ XMLPUBFUN int
263
+ xmlPopOutputCallbacks (void);
264
+ XMLPUBFUN void
265
+ xmlRegisterDefaultOutputCallbacks(void);
266
+ XMLPUBFUN xmlOutputBufferPtr
267
+ xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
268
+
269
+ XMLPUBFUN xmlOutputBufferPtr
270
+ xmlOutputBufferCreateFilename (const char *URI,
271
+ xmlCharEncodingHandlerPtr encoder,
272
+ int compression);
273
+
274
+ XMLPUBFUN xmlOutputBufferPtr
275
+ xmlOutputBufferCreateFile (FILE *file,
276
+ xmlCharEncodingHandlerPtr encoder);
277
+
278
+ XMLPUBFUN xmlOutputBufferPtr
279
+ xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
280
+ xmlCharEncodingHandlerPtr encoder);
281
+
282
+ XMLPUBFUN xmlOutputBufferPtr
283
+ xmlOutputBufferCreateFd (int fd,
284
+ xmlCharEncodingHandlerPtr encoder);
285
+
286
+ XMLPUBFUN 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 */
293
+ XMLPUBFUN const xmlChar *
294
+ xmlOutputBufferGetContent (xmlOutputBufferPtr out);
295
+ XMLPUBFUN size_t
296
+ xmlOutputBufferGetSize (xmlOutputBufferPtr out);
297
+
298
+ XMLPUBFUN int
299
+ xmlOutputBufferWrite (xmlOutputBufferPtr out,
300
+ int len,
301
+ const char *buf);
302
+ XMLPUBFUN int
303
+ xmlOutputBufferWriteString (xmlOutputBufferPtr out,
304
+ const char *str);
305
+ XMLPUBFUN int
306
+ xmlOutputBufferWriteEscape (xmlOutputBufferPtr out,
307
+ const xmlChar *str,
308
+ xmlCharEncodingOutputFunc escaping);
309
+
310
+ XMLPUBFUN int
311
+ xmlOutputBufferFlush (xmlOutputBufferPtr out);
312
+ XMLPUBFUN int
313
+ xmlOutputBufferClose (xmlOutputBufferPtr out);
314
+
315
+ XMLPUBFUN int
316
+ xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
317
+ xmlOutputOpenCallback openFunc,
318
+ xmlOutputWriteCallback writeFunc,
319
+ xmlOutputCloseCallback closeFunc);
320
+
321
+ xmlOutputBufferPtr
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 */
328
+ XML_DEPRECATED
329
+ XMLPUBFUN void
330
+ xmlRegisterHTTPPostCallbacks (void );
331
+ #endif /* LIBXML_HTTP_ENABLED */
332
+
333
+ #endif /* LIBXML_OUTPUT_ENABLED */
334
+
335
+ XML_DEPRECATED
336
+ XMLPUBFUN xmlParserInputPtr
337
+ xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
338
+ xmlParserInputPtr ret);
339
+
340
+ /*
341
+ * A predefined entity loader disabling network accesses
342
+ */
343
+ XMLPUBFUN xmlParserInputPtr
344
+ xmlNoNetExternalEntityLoader (const char *URL,
345
+ const char *ID,
346
+ xmlParserCtxtPtr ctxt);
347
+
348
+ XML_DEPRECATED
349
+ XMLPUBFUN xmlChar *
350
+ xmlNormalizeWindowsPath (const xmlChar *path);
351
+
352
+ XML_DEPRECATED
353
+ XMLPUBFUN int
354
+ xmlCheckFilename (const char *path);
355
+ /**
356
+ * Default 'file://' protocol callbacks
357
+ */
358
+ XML_DEPRECATED
359
+ XMLPUBFUN int
360
+ xmlFileMatch (const char *filename);
361
+ XML_DEPRECATED
362
+ XMLPUBFUN void *
363
+ xmlFileOpen (const char *filename);
364
+ XML_DEPRECATED
365
+ XMLPUBFUN int
366
+ xmlFileRead (void * context,
367
+ char * buffer,
368
+ int len);
369
+ XML_DEPRECATED
370
+ XMLPUBFUN int
371
+ xmlFileClose (void * context);
372
+
373
+ /**
374
+ * Default 'http://' protocol callbacks
375
+ */
376
+ #ifdef LIBXML_HTTP_ENABLED
377
+ XML_DEPRECATED
378
+ XMLPUBFUN int
379
+ xmlIOHTTPMatch (const char *filename);
380
+ XML_DEPRECATED
381
+ XMLPUBFUN void *
382
+ xmlIOHTTPOpen (const char *filename);
383
+ #ifdef LIBXML_OUTPUT_ENABLED
384
+ XML_DEPRECATED
385
+ XMLPUBFUN void *
386
+ xmlIOHTTPOpenW (const char * post_uri,
387
+ int compression );
388
+ #endif /* LIBXML_OUTPUT_ENABLED */
389
+ XML_DEPRECATED
390
+ XMLPUBFUN int
391
+ xmlIOHTTPRead (void * context,
392
+ char * buffer,
393
+ int len);
394
+ XML_DEPRECATED
395
+ XMLPUBFUN int
396
+ xmlIOHTTPClose (void * context);
397
+ #endif /* LIBXML_HTTP_ENABLED */
398
+
399
+ /**
400
+ * Default 'ftp://' protocol callbacks
401
+ */
402
+ #if defined(LIBXML_FTP_ENABLED)
403
+ XML_DEPRECATED
404
+ XMLPUBFUN int
405
+ xmlIOFTPMatch (const char *filename);
406
+ XML_DEPRECATED
407
+ XMLPUBFUN void *
408
+ xmlIOFTPOpen (const char *filename);
409
+ XML_DEPRECATED
410
+ XMLPUBFUN int
411
+ xmlIOFTPRead (void * context,
412
+ char * buffer,
413
+ int len);
414
+ XML_DEPRECATED
415
+ XMLPUBFUN int
416
+ xmlIOFTPClose (void * context);
417
+ #endif /* defined(LIBXML_FTP_ENABLED) */
418
+
419
+ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
420
+ xmlParserInputBufferCreateFilenameDefault(
421
+ xmlParserInputBufferCreateFilenameFunc func);
422
+ XMLPUBFUN xmlOutputBufferCreateFilenameFunc
423
+ xmlOutputBufferCreateFilenameDefault(
424
+ xmlOutputBufferCreateFilenameFunc func);
425
+ XML_DEPRECATED
426
+ XMLPUBFUN xmlOutputBufferCreateFilenameFunc
427
+ xmlThrDefOutputBufferCreateFilenameDefault(
428
+ xmlOutputBufferCreateFilenameFunc func);
429
+ XML_DEPRECATED
430
+ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
431
+ xmlThrDefParserInputBufferCreateFilenameDefault(
432
+ xmlParserInputBufferCreateFilenameFunc func);
433
+
434
+ #ifdef __cplusplus
435
+ }
436
+ #endif
437
+
438
+ #endif /* __XML_IO_H__ */