jpayne@69
|
1 /*
|
jpayne@69
|
2 __ __ _
|
jpayne@69
|
3 ___\ \/ /_ __ __ _| |_
|
jpayne@69
|
4 / _ \\ /| '_ \ / _` | __|
|
jpayne@69
|
5 | __// \| |_) | (_| | |_
|
jpayne@69
|
6 \___/_/\_\ .__/ \__,_|\__|
|
jpayne@69
|
7 |_| XML parser
|
jpayne@69
|
8
|
jpayne@69
|
9 Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
jpayne@69
|
10 Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
jpayne@69
|
11 Copyright (c) 2000-2005 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
jpayne@69
|
12 Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
|
jpayne@69
|
13 Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
|
jpayne@69
|
14 Copyright (c) 2016-2024 Sebastian Pipping <sebastian@pipping.org>
|
jpayne@69
|
15 Copyright (c) 2016 Cristian Rodríguez <crrodriguez@opensuse.org>
|
jpayne@69
|
16 Copyright (c) 2016 Thomas Beutlich <tc@tbeu.de>
|
jpayne@69
|
17 Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
|
jpayne@69
|
18 Copyright (c) 2022 Thijs Schreijer <thijs@thijsschreijer.nl>
|
jpayne@69
|
19 Copyright (c) 2023 Hanno Böck <hanno@gentoo.org>
|
jpayne@69
|
20 Copyright (c) 2023 Sony Corporation / Snild Dolkow <snild@sony.com>
|
jpayne@69
|
21 Copyright (c) 2024 Taichi Haradaguchi <20001722@ymail.ne.jp>
|
jpayne@69
|
22 Licensed under the MIT license:
|
jpayne@69
|
23
|
jpayne@69
|
24 Permission is hereby granted, free of charge, to any person obtaining
|
jpayne@69
|
25 a copy of this software and associated documentation files (the
|
jpayne@69
|
26 "Software"), to deal in the Software without restriction, including
|
jpayne@69
|
27 without limitation the rights to use, copy, modify, merge, publish,
|
jpayne@69
|
28 distribute, sublicense, and/or sell copies of the Software, and to permit
|
jpayne@69
|
29 persons to whom the Software is furnished to do so, subject to the
|
jpayne@69
|
30 following conditions:
|
jpayne@69
|
31
|
jpayne@69
|
32 The above copyright notice and this permission notice shall be included
|
jpayne@69
|
33 in all copies or substantial portions of the Software.
|
jpayne@69
|
34
|
jpayne@69
|
35 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
jpayne@69
|
36 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
jpayne@69
|
37 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
jpayne@69
|
38 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
jpayne@69
|
39 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
jpayne@69
|
40 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
jpayne@69
|
41 USE OR OTHER DEALINGS IN THE SOFTWARE.
|
jpayne@69
|
42 */
|
jpayne@69
|
43
|
jpayne@69
|
44 #ifndef Expat_INCLUDED
|
jpayne@69
|
45 #define Expat_INCLUDED 1
|
jpayne@69
|
46
|
jpayne@69
|
47 #include <stdlib.h>
|
jpayne@69
|
48 #include "expat_external.h"
|
jpayne@69
|
49
|
jpayne@69
|
50 #ifdef __cplusplus
|
jpayne@69
|
51 extern "C" {
|
jpayne@69
|
52 #endif
|
jpayne@69
|
53
|
jpayne@69
|
54 struct XML_ParserStruct;
|
jpayne@69
|
55 typedef struct XML_ParserStruct *XML_Parser;
|
jpayne@69
|
56
|
jpayne@69
|
57 typedef unsigned char XML_Bool;
|
jpayne@69
|
58 #define XML_TRUE ((XML_Bool)1)
|
jpayne@69
|
59 #define XML_FALSE ((XML_Bool)0)
|
jpayne@69
|
60
|
jpayne@69
|
61 /* The XML_Status enum gives the possible return values for several
|
jpayne@69
|
62 API functions. The preprocessor #defines are included so this
|
jpayne@69
|
63 stanza can be added to code that still needs to support older
|
jpayne@69
|
64 versions of Expat 1.95.x:
|
jpayne@69
|
65
|
jpayne@69
|
66 #ifndef XML_STATUS_OK
|
jpayne@69
|
67 #define XML_STATUS_OK 1
|
jpayne@69
|
68 #define XML_STATUS_ERROR 0
|
jpayne@69
|
69 #endif
|
jpayne@69
|
70
|
jpayne@69
|
71 Otherwise, the #define hackery is quite ugly and would have been
|
jpayne@69
|
72 dropped.
|
jpayne@69
|
73 */
|
jpayne@69
|
74 enum XML_Status {
|
jpayne@69
|
75 XML_STATUS_ERROR = 0,
|
jpayne@69
|
76 #define XML_STATUS_ERROR XML_STATUS_ERROR
|
jpayne@69
|
77 XML_STATUS_OK = 1,
|
jpayne@69
|
78 #define XML_STATUS_OK XML_STATUS_OK
|
jpayne@69
|
79 XML_STATUS_SUSPENDED = 2
|
jpayne@69
|
80 #define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
|
jpayne@69
|
81 };
|
jpayne@69
|
82
|
jpayne@69
|
83 enum XML_Error {
|
jpayne@69
|
84 XML_ERROR_NONE,
|
jpayne@69
|
85 XML_ERROR_NO_MEMORY,
|
jpayne@69
|
86 XML_ERROR_SYNTAX,
|
jpayne@69
|
87 XML_ERROR_NO_ELEMENTS,
|
jpayne@69
|
88 XML_ERROR_INVALID_TOKEN,
|
jpayne@69
|
89 XML_ERROR_UNCLOSED_TOKEN,
|
jpayne@69
|
90 XML_ERROR_PARTIAL_CHAR,
|
jpayne@69
|
91 XML_ERROR_TAG_MISMATCH,
|
jpayne@69
|
92 XML_ERROR_DUPLICATE_ATTRIBUTE,
|
jpayne@69
|
93 XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
|
jpayne@69
|
94 XML_ERROR_PARAM_ENTITY_REF,
|
jpayne@69
|
95 XML_ERROR_UNDEFINED_ENTITY,
|
jpayne@69
|
96 XML_ERROR_RECURSIVE_ENTITY_REF,
|
jpayne@69
|
97 XML_ERROR_ASYNC_ENTITY,
|
jpayne@69
|
98 XML_ERROR_BAD_CHAR_REF,
|
jpayne@69
|
99 XML_ERROR_BINARY_ENTITY_REF,
|
jpayne@69
|
100 XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
|
jpayne@69
|
101 XML_ERROR_MISPLACED_XML_PI,
|
jpayne@69
|
102 XML_ERROR_UNKNOWN_ENCODING,
|
jpayne@69
|
103 XML_ERROR_INCORRECT_ENCODING,
|
jpayne@69
|
104 XML_ERROR_UNCLOSED_CDATA_SECTION,
|
jpayne@69
|
105 XML_ERROR_EXTERNAL_ENTITY_HANDLING,
|
jpayne@69
|
106 XML_ERROR_NOT_STANDALONE,
|
jpayne@69
|
107 XML_ERROR_UNEXPECTED_STATE,
|
jpayne@69
|
108 XML_ERROR_ENTITY_DECLARED_IN_PE,
|
jpayne@69
|
109 XML_ERROR_FEATURE_REQUIRES_XML_DTD,
|
jpayne@69
|
110 XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING,
|
jpayne@69
|
111 /* Added in 1.95.7. */
|
jpayne@69
|
112 XML_ERROR_UNBOUND_PREFIX,
|
jpayne@69
|
113 /* Added in 1.95.8. */
|
jpayne@69
|
114 XML_ERROR_UNDECLARING_PREFIX,
|
jpayne@69
|
115 XML_ERROR_INCOMPLETE_PE,
|
jpayne@69
|
116 XML_ERROR_XML_DECL,
|
jpayne@69
|
117 XML_ERROR_TEXT_DECL,
|
jpayne@69
|
118 XML_ERROR_PUBLICID,
|
jpayne@69
|
119 XML_ERROR_SUSPENDED,
|
jpayne@69
|
120 XML_ERROR_NOT_SUSPENDED,
|
jpayne@69
|
121 XML_ERROR_ABORTED,
|
jpayne@69
|
122 XML_ERROR_FINISHED,
|
jpayne@69
|
123 XML_ERROR_SUSPEND_PE,
|
jpayne@69
|
124 /* Added in 2.0. */
|
jpayne@69
|
125 XML_ERROR_RESERVED_PREFIX_XML,
|
jpayne@69
|
126 XML_ERROR_RESERVED_PREFIX_XMLNS,
|
jpayne@69
|
127 XML_ERROR_RESERVED_NAMESPACE_URI,
|
jpayne@69
|
128 /* Added in 2.2.1. */
|
jpayne@69
|
129 XML_ERROR_INVALID_ARGUMENT,
|
jpayne@69
|
130 /* Added in 2.3.0. */
|
jpayne@69
|
131 XML_ERROR_NO_BUFFER,
|
jpayne@69
|
132 /* Added in 2.4.0. */
|
jpayne@69
|
133 XML_ERROR_AMPLIFICATION_LIMIT_BREACH,
|
jpayne@69
|
134 /* Added in 2.6.4. */
|
jpayne@69
|
135 XML_ERROR_NOT_STARTED,
|
jpayne@69
|
136 };
|
jpayne@69
|
137
|
jpayne@69
|
138 enum XML_Content_Type {
|
jpayne@69
|
139 XML_CTYPE_EMPTY = 1,
|
jpayne@69
|
140 XML_CTYPE_ANY,
|
jpayne@69
|
141 XML_CTYPE_MIXED,
|
jpayne@69
|
142 XML_CTYPE_NAME,
|
jpayne@69
|
143 XML_CTYPE_CHOICE,
|
jpayne@69
|
144 XML_CTYPE_SEQ
|
jpayne@69
|
145 };
|
jpayne@69
|
146
|
jpayne@69
|
147 enum XML_Content_Quant {
|
jpayne@69
|
148 XML_CQUANT_NONE,
|
jpayne@69
|
149 XML_CQUANT_OPT,
|
jpayne@69
|
150 XML_CQUANT_REP,
|
jpayne@69
|
151 XML_CQUANT_PLUS
|
jpayne@69
|
152 };
|
jpayne@69
|
153
|
jpayne@69
|
154 /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be
|
jpayne@69
|
155 XML_CQUANT_NONE, and the other fields will be zero or NULL.
|
jpayne@69
|
156 If type == XML_CTYPE_MIXED, then quant will be NONE or REP and
|
jpayne@69
|
157 numchildren will contain number of elements that may be mixed in
|
jpayne@69
|
158 and children point to an array of XML_Content cells that will be
|
jpayne@69
|
159 all of XML_CTYPE_NAME type with no quantification.
|
jpayne@69
|
160
|
jpayne@69
|
161 If type == XML_CTYPE_NAME, then the name points to the name, and
|
jpayne@69
|
162 the numchildren field will be zero and children will be NULL. The
|
jpayne@69
|
163 quant fields indicates any quantifiers placed on the name.
|
jpayne@69
|
164
|
jpayne@69
|
165 CHOICE and SEQ will have name NULL, the number of children in
|
jpayne@69
|
166 numchildren and children will point, recursively, to an array
|
jpayne@69
|
167 of XML_Content cells.
|
jpayne@69
|
168
|
jpayne@69
|
169 The EMPTY, ANY, and MIXED types will only occur at top level.
|
jpayne@69
|
170 */
|
jpayne@69
|
171
|
jpayne@69
|
172 typedef struct XML_cp XML_Content;
|
jpayne@69
|
173
|
jpayne@69
|
174 struct XML_cp {
|
jpayne@69
|
175 enum XML_Content_Type type;
|
jpayne@69
|
176 enum XML_Content_Quant quant;
|
jpayne@69
|
177 XML_Char *name;
|
jpayne@69
|
178 unsigned int numchildren;
|
jpayne@69
|
179 XML_Content *children;
|
jpayne@69
|
180 };
|
jpayne@69
|
181
|
jpayne@69
|
182 /* This is called for an element declaration. See above for
|
jpayne@69
|
183 description of the model argument. It's the user code's responsibility
|
jpayne@69
|
184 to free model when finished with it. See XML_FreeContentModel.
|
jpayne@69
|
185 There is no need to free the model from the handler, it can be kept
|
jpayne@69
|
186 around and freed at a later stage.
|
jpayne@69
|
187 */
|
jpayne@69
|
188 typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData,
|
jpayne@69
|
189 const XML_Char *name,
|
jpayne@69
|
190 XML_Content *model);
|
jpayne@69
|
191
|
jpayne@69
|
192 XMLPARSEAPI(void)
|
jpayne@69
|
193 XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl);
|
jpayne@69
|
194
|
jpayne@69
|
195 /* The Attlist declaration handler is called for *each* attribute. So
|
jpayne@69
|
196 a single Attlist declaration with multiple attributes declared will
|
jpayne@69
|
197 generate multiple calls to this handler. The "default" parameter
|
jpayne@69
|
198 may be NULL in the case of the "#IMPLIED" or "#REQUIRED"
|
jpayne@69
|
199 keyword. The "isrequired" parameter will be true and the default
|
jpayne@69
|
200 value will be NULL in the case of "#REQUIRED". If "isrequired" is
|
jpayne@69
|
201 true and default is non-NULL, then this is a "#FIXED" default.
|
jpayne@69
|
202 */
|
jpayne@69
|
203 typedef void(XMLCALL *XML_AttlistDeclHandler)(
|
jpayne@69
|
204 void *userData, const XML_Char *elname, const XML_Char *attname,
|
jpayne@69
|
205 const XML_Char *att_type, const XML_Char *dflt, int isrequired);
|
jpayne@69
|
206
|
jpayne@69
|
207 XMLPARSEAPI(void)
|
jpayne@69
|
208 XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl);
|
jpayne@69
|
209
|
jpayne@69
|
210 /* The XML declaration handler is called for *both* XML declarations
|
jpayne@69
|
211 and text declarations. The way to distinguish is that the version
|
jpayne@69
|
212 parameter will be NULL for text declarations. The encoding
|
jpayne@69
|
213 parameter may be NULL for XML declarations. The standalone
|
jpayne@69
|
214 parameter will be -1, 0, or 1 indicating respectively that there
|
jpayne@69
|
215 was no standalone parameter in the declaration, that it was given
|
jpayne@69
|
216 as no, or that it was given as yes.
|
jpayne@69
|
217 */
|
jpayne@69
|
218 typedef void(XMLCALL *XML_XmlDeclHandler)(void *userData,
|
jpayne@69
|
219 const XML_Char *version,
|
jpayne@69
|
220 const XML_Char *encoding,
|
jpayne@69
|
221 int standalone);
|
jpayne@69
|
222
|
jpayne@69
|
223 XMLPARSEAPI(void)
|
jpayne@69
|
224 XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl);
|
jpayne@69
|
225
|
jpayne@69
|
226 typedef struct {
|
jpayne@69
|
227 void *(*malloc_fcn)(size_t size);
|
jpayne@69
|
228 void *(*realloc_fcn)(void *ptr, size_t size);
|
jpayne@69
|
229 void (*free_fcn)(void *ptr);
|
jpayne@69
|
230 } XML_Memory_Handling_Suite;
|
jpayne@69
|
231
|
jpayne@69
|
232 /* Constructs a new parser; encoding is the encoding specified by the
|
jpayne@69
|
233 external protocol or NULL if there is none specified.
|
jpayne@69
|
234 */
|
jpayne@69
|
235 XMLPARSEAPI(XML_Parser)
|
jpayne@69
|
236 XML_ParserCreate(const XML_Char *encoding);
|
jpayne@69
|
237
|
jpayne@69
|
238 /* Constructs a new parser and namespace processor. Element type
|
jpayne@69
|
239 names and attribute names that belong to a namespace will be
|
jpayne@69
|
240 expanded; unprefixed attribute names are never expanded; unprefixed
|
jpayne@69
|
241 element type names are expanded only if there is a default
|
jpayne@69
|
242 namespace. The expanded name is the concatenation of the namespace
|
jpayne@69
|
243 URI, the namespace separator character, and the local part of the
|
jpayne@69
|
244 name. If the namespace separator is '\0' then the namespace URI
|
jpayne@69
|
245 and the local part will be concatenated without any separator.
|
jpayne@69
|
246 It is a programming error to use the separator '\0' with namespace
|
jpayne@69
|
247 triplets (see XML_SetReturnNSTriplet).
|
jpayne@69
|
248 If a namespace separator is chosen that can be part of a URI or
|
jpayne@69
|
249 part of an XML name, splitting an expanded name back into its
|
jpayne@69
|
250 1, 2 or 3 original parts on application level in the element handler
|
jpayne@69
|
251 may end up vulnerable, so these are advised against; sane choices for
|
jpayne@69
|
252 a namespace separator are e.g. '\n' (line feed) and '|' (pipe).
|
jpayne@69
|
253
|
jpayne@69
|
254 Note that Expat does not validate namespace URIs (beyond encoding)
|
jpayne@69
|
255 against RFC 3986 today (and is not required to do so with regard to
|
jpayne@69
|
256 the XML 1.0 namespaces specification) but it may start doing that
|
jpayne@69
|
257 in future releases. Before that, an application using Expat must
|
jpayne@69
|
258 be ready to receive namespace URIs containing non-URI characters.
|
jpayne@69
|
259 */
|
jpayne@69
|
260 XMLPARSEAPI(XML_Parser)
|
jpayne@69
|
261 XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
|
jpayne@69
|
262
|
jpayne@69
|
263 /* Constructs a new parser using the memory management suite referred to
|
jpayne@69
|
264 by memsuite. If memsuite is NULL, then use the standard library memory
|
jpayne@69
|
265 suite. If namespaceSeparator is non-NULL it creates a parser with
|
jpayne@69
|
266 namespace processing as described above. The character pointed at
|
jpayne@69
|
267 will serve as the namespace separator.
|
jpayne@69
|
268
|
jpayne@69
|
269 All further memory operations used for the created parser will come from
|
jpayne@69
|
270 the given suite.
|
jpayne@69
|
271 */
|
jpayne@69
|
272 XMLPARSEAPI(XML_Parser)
|
jpayne@69
|
273 XML_ParserCreate_MM(const XML_Char *encoding,
|
jpayne@69
|
274 const XML_Memory_Handling_Suite *memsuite,
|
jpayne@69
|
275 const XML_Char *namespaceSeparator);
|
jpayne@69
|
276
|
jpayne@69
|
277 /* Prepare a parser object to be reused. This is particularly
|
jpayne@69
|
278 valuable when memory allocation overhead is disproportionately high,
|
jpayne@69
|
279 such as when a large number of small documnents need to be parsed.
|
jpayne@69
|
280 All handlers are cleared from the parser, except for the
|
jpayne@69
|
281 unknownEncodingHandler. The parser's external state is re-initialized
|
jpayne@69
|
282 except for the values of ns and ns_triplets.
|
jpayne@69
|
283
|
jpayne@69
|
284 Added in Expat 1.95.3.
|
jpayne@69
|
285 */
|
jpayne@69
|
286 XMLPARSEAPI(XML_Bool)
|
jpayne@69
|
287 XML_ParserReset(XML_Parser parser, const XML_Char *encoding);
|
jpayne@69
|
288
|
jpayne@69
|
289 /* atts is array of name/value pairs, terminated by 0;
|
jpayne@69
|
290 names and values are 0 terminated.
|
jpayne@69
|
291 */
|
jpayne@69
|
292 typedef void(XMLCALL *XML_StartElementHandler)(void *userData,
|
jpayne@69
|
293 const XML_Char *name,
|
jpayne@69
|
294 const XML_Char **atts);
|
jpayne@69
|
295
|
jpayne@69
|
296 typedef void(XMLCALL *XML_EndElementHandler)(void *userData,
|
jpayne@69
|
297 const XML_Char *name);
|
jpayne@69
|
298
|
jpayne@69
|
299 /* s is not 0 terminated. */
|
jpayne@69
|
300 typedef void(XMLCALL *XML_CharacterDataHandler)(void *userData,
|
jpayne@69
|
301 const XML_Char *s, int len);
|
jpayne@69
|
302
|
jpayne@69
|
303 /* target and data are 0 terminated */
|
jpayne@69
|
304 typedef void(XMLCALL *XML_ProcessingInstructionHandler)(void *userData,
|
jpayne@69
|
305 const XML_Char *target,
|
jpayne@69
|
306 const XML_Char *data);
|
jpayne@69
|
307
|
jpayne@69
|
308 /* data is 0 terminated */
|
jpayne@69
|
309 typedef void(XMLCALL *XML_CommentHandler)(void *userData, const XML_Char *data);
|
jpayne@69
|
310
|
jpayne@69
|
311 typedef void(XMLCALL *XML_StartCdataSectionHandler)(void *userData);
|
jpayne@69
|
312 typedef void(XMLCALL *XML_EndCdataSectionHandler)(void *userData);
|
jpayne@69
|
313
|
jpayne@69
|
314 /* This is called for any characters in the XML document for which
|
jpayne@69
|
315 there is no applicable handler. This includes both characters that
|
jpayne@69
|
316 are part of markup which is of a kind that is not reported
|
jpayne@69
|
317 (comments, markup declarations), or characters that are part of a
|
jpayne@69
|
318 construct which could be reported but for which no handler has been
|
jpayne@69
|
319 supplied. The characters are passed exactly as they were in the XML
|
jpayne@69
|
320 document except that they will be encoded in UTF-8 or UTF-16.
|
jpayne@69
|
321 Line boundaries are not normalized. Note that a byte order mark
|
jpayne@69
|
322 character is not passed to the default handler. There are no
|
jpayne@69
|
323 guarantees about how characters are divided between calls to the
|
jpayne@69
|
324 default handler: for example, a comment might be split between
|
jpayne@69
|
325 multiple calls.
|
jpayne@69
|
326 */
|
jpayne@69
|
327 typedef void(XMLCALL *XML_DefaultHandler)(void *userData, const XML_Char *s,
|
jpayne@69
|
328 int len);
|
jpayne@69
|
329
|
jpayne@69
|
330 /* This is called for the start of the DOCTYPE declaration, before
|
jpayne@69
|
331 any DTD or internal subset is parsed.
|
jpayne@69
|
332 */
|
jpayne@69
|
333 typedef void(XMLCALL *XML_StartDoctypeDeclHandler)(void *userData,
|
jpayne@69
|
334 const XML_Char *doctypeName,
|
jpayne@69
|
335 const XML_Char *sysid,
|
jpayne@69
|
336 const XML_Char *pubid,
|
jpayne@69
|
337 int has_internal_subset);
|
jpayne@69
|
338
|
jpayne@69
|
339 /* This is called for the end of the DOCTYPE declaration when the
|
jpayne@69
|
340 closing > is encountered, but after processing any external
|
jpayne@69
|
341 subset.
|
jpayne@69
|
342 */
|
jpayne@69
|
343 typedef void(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
|
jpayne@69
|
344
|
jpayne@69
|
345 /* This is called for entity declarations. The is_parameter_entity
|
jpayne@69
|
346 argument will be non-zero if the entity is a parameter entity, zero
|
jpayne@69
|
347 otherwise.
|
jpayne@69
|
348
|
jpayne@69
|
349 For internal entities (<!ENTITY foo "bar">), value will
|
jpayne@69
|
350 be non-NULL and systemId, publicID, and notationName will be NULL.
|
jpayne@69
|
351 The value string is NOT null-terminated; the length is provided in
|
jpayne@69
|
352 the value_length argument. Since it is legal to have zero-length
|
jpayne@69
|
353 values, do not use this argument to test for internal entities.
|
jpayne@69
|
354
|
jpayne@69
|
355 For external entities, value will be NULL and systemId will be
|
jpayne@69
|
356 non-NULL. The publicId argument will be NULL unless a public
|
jpayne@69
|
357 identifier was provided. The notationName argument will have a
|
jpayne@69
|
358 non-NULL value only for unparsed entity declarations.
|
jpayne@69
|
359
|
jpayne@69
|
360 Note that is_parameter_entity can't be changed to XML_Bool, since
|
jpayne@69
|
361 that would break binary compatibility.
|
jpayne@69
|
362 */
|
jpayne@69
|
363 typedef void(XMLCALL *XML_EntityDeclHandler)(
|
jpayne@69
|
364 void *userData, const XML_Char *entityName, int is_parameter_entity,
|
jpayne@69
|
365 const XML_Char *value, int value_length, const XML_Char *base,
|
jpayne@69
|
366 const XML_Char *systemId, const XML_Char *publicId,
|
jpayne@69
|
367 const XML_Char *notationName);
|
jpayne@69
|
368
|
jpayne@69
|
369 XMLPARSEAPI(void)
|
jpayne@69
|
370 XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler);
|
jpayne@69
|
371
|
jpayne@69
|
372 /* OBSOLETE -- OBSOLETE -- OBSOLETE
|
jpayne@69
|
373 This handler has been superseded by the EntityDeclHandler above.
|
jpayne@69
|
374 It is provided here for backward compatibility.
|
jpayne@69
|
375
|
jpayne@69
|
376 This is called for a declaration of an unparsed (NDATA) entity.
|
jpayne@69
|
377 The base argument is whatever was set by XML_SetBase. The
|
jpayne@69
|
378 entityName, systemId and notationName arguments will never be
|
jpayne@69
|
379 NULL. The other arguments may be.
|
jpayne@69
|
380 */
|
jpayne@69
|
381 typedef void(XMLCALL *XML_UnparsedEntityDeclHandler)(
|
jpayne@69
|
382 void *userData, const XML_Char *entityName, const XML_Char *base,
|
jpayne@69
|
383 const XML_Char *systemId, const XML_Char *publicId,
|
jpayne@69
|
384 const XML_Char *notationName);
|
jpayne@69
|
385
|
jpayne@69
|
386 /* This is called for a declaration of notation. The base argument is
|
jpayne@69
|
387 whatever was set by XML_SetBase. The notationName will never be
|
jpayne@69
|
388 NULL. The other arguments can be.
|
jpayne@69
|
389 */
|
jpayne@69
|
390 typedef void(XMLCALL *XML_NotationDeclHandler)(void *userData,
|
jpayne@69
|
391 const XML_Char *notationName,
|
jpayne@69
|
392 const XML_Char *base,
|
jpayne@69
|
393 const XML_Char *systemId,
|
jpayne@69
|
394 const XML_Char *publicId);
|
jpayne@69
|
395
|
jpayne@69
|
396 /* When namespace processing is enabled, these are called once for
|
jpayne@69
|
397 each namespace declaration. The call to the start and end element
|
jpayne@69
|
398 handlers occur between the calls to the start and end namespace
|
jpayne@69
|
399 declaration handlers. For an xmlns attribute, prefix will be
|
jpayne@69
|
400 NULL. For an xmlns="" attribute, uri will be NULL.
|
jpayne@69
|
401 */
|
jpayne@69
|
402 typedef void(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData,
|
jpayne@69
|
403 const XML_Char *prefix,
|
jpayne@69
|
404 const XML_Char *uri);
|
jpayne@69
|
405
|
jpayne@69
|
406 typedef void(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,
|
jpayne@69
|
407 const XML_Char *prefix);
|
jpayne@69
|
408
|
jpayne@69
|
409 /* This is called if the document is not standalone, that is, it has an
|
jpayne@69
|
410 external subset or a reference to a parameter entity, but does not
|
jpayne@69
|
411 have standalone="yes". If this handler returns XML_STATUS_ERROR,
|
jpayne@69
|
412 then processing will not continue, and the parser will return a
|
jpayne@69
|
413 XML_ERROR_NOT_STANDALONE error.
|
jpayne@69
|
414 If parameter entity parsing is enabled, then in addition to the
|
jpayne@69
|
415 conditions above this handler will only be called if the referenced
|
jpayne@69
|
416 entity was actually read.
|
jpayne@69
|
417 */
|
jpayne@69
|
418 typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData);
|
jpayne@69
|
419
|
jpayne@69
|
420 /* This is called for a reference to an external parsed general
|
jpayne@69
|
421 entity. The referenced entity is not automatically parsed. The
|
jpayne@69
|
422 application can parse it immediately or later using
|
jpayne@69
|
423 XML_ExternalEntityParserCreate.
|
jpayne@69
|
424
|
jpayne@69
|
425 The parser argument is the parser parsing the entity containing the
|
jpayne@69
|
426 reference; it can be passed as the parser argument to
|
jpayne@69
|
427 XML_ExternalEntityParserCreate. The systemId argument is the
|
jpayne@69
|
428 system identifier as specified in the entity declaration; it will
|
jpayne@69
|
429 not be NULL.
|
jpayne@69
|
430
|
jpayne@69
|
431 The base argument is the system identifier that should be used as
|
jpayne@69
|
432 the base for resolving systemId if systemId was relative; this is
|
jpayne@69
|
433 set by XML_SetBase; it may be NULL.
|
jpayne@69
|
434
|
jpayne@69
|
435 The publicId argument is the public identifier as specified in the
|
jpayne@69
|
436 entity declaration, or NULL if none was specified; the whitespace
|
jpayne@69
|
437 in the public identifier will have been normalized as required by
|
jpayne@69
|
438 the XML spec.
|
jpayne@69
|
439
|
jpayne@69
|
440 The context argument specifies the parsing context in the format
|
jpayne@69
|
441 expected by the context argument to XML_ExternalEntityParserCreate;
|
jpayne@69
|
442 context is valid only until the handler returns, so if the
|
jpayne@69
|
443 referenced entity is to be parsed later, it must be copied.
|
jpayne@69
|
444 context is NULL only when the entity is a parameter entity.
|
jpayne@69
|
445
|
jpayne@69
|
446 The handler should return XML_STATUS_ERROR if processing should not
|
jpayne@69
|
447 continue because of a fatal error in the handling of the external
|
jpayne@69
|
448 entity. In this case the calling parser will return an
|
jpayne@69
|
449 XML_ERROR_EXTERNAL_ENTITY_HANDLING error.
|
jpayne@69
|
450
|
jpayne@69
|
451 Note that unlike other handlers the first argument is the parser,
|
jpayne@69
|
452 not userData.
|
jpayne@69
|
453 */
|
jpayne@69
|
454 typedef int(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser parser,
|
jpayne@69
|
455 const XML_Char *context,
|
jpayne@69
|
456 const XML_Char *base,
|
jpayne@69
|
457 const XML_Char *systemId,
|
jpayne@69
|
458 const XML_Char *publicId);
|
jpayne@69
|
459
|
jpayne@69
|
460 /* This is called in two situations:
|
jpayne@69
|
461 1) An entity reference is encountered for which no declaration
|
jpayne@69
|
462 has been read *and* this is not an error.
|
jpayne@69
|
463 2) An internal entity reference is read, but not expanded, because
|
jpayne@69
|
464 XML_SetDefaultHandler has been called.
|
jpayne@69
|
465 Note: skipped parameter entities in declarations and skipped general
|
jpayne@69
|
466 entities in attribute values cannot be reported, because
|
jpayne@69
|
467 the event would be out of sync with the reporting of the
|
jpayne@69
|
468 declarations or attribute values
|
jpayne@69
|
469 */
|
jpayne@69
|
470 typedef void(XMLCALL *XML_SkippedEntityHandler)(void *userData,
|
jpayne@69
|
471 const XML_Char *entityName,
|
jpayne@69
|
472 int is_parameter_entity);
|
jpayne@69
|
473
|
jpayne@69
|
474 /* This structure is filled in by the XML_UnknownEncodingHandler to
|
jpayne@69
|
475 provide information to the parser about encodings that are unknown
|
jpayne@69
|
476 to the parser.
|
jpayne@69
|
477
|
jpayne@69
|
478 The map[b] member gives information about byte sequences whose
|
jpayne@69
|
479 first byte is b.
|
jpayne@69
|
480
|
jpayne@69
|
481 If map[b] is c where c is >= 0, then b by itself encodes the
|
jpayne@69
|
482 Unicode scalar value c.
|
jpayne@69
|
483
|
jpayne@69
|
484 If map[b] is -1, then the byte sequence is malformed.
|
jpayne@69
|
485
|
jpayne@69
|
486 If map[b] is -n, where n >= 2, then b is the first byte of an
|
jpayne@69
|
487 n-byte sequence that encodes a single Unicode scalar value.
|
jpayne@69
|
488
|
jpayne@69
|
489 The data member will be passed as the first argument to the convert
|
jpayne@69
|
490 function.
|
jpayne@69
|
491
|
jpayne@69
|
492 The convert function is used to convert multibyte sequences; s will
|
jpayne@69
|
493 point to a n-byte sequence where map[(unsigned char)*s] == -n. The
|
jpayne@69
|
494 convert function must return the Unicode scalar value represented
|
jpayne@69
|
495 by this byte sequence or -1 if the byte sequence is malformed.
|
jpayne@69
|
496
|
jpayne@69
|
497 The convert function may be NULL if the encoding is a single-byte
|
jpayne@69
|
498 encoding, that is if map[b] >= -1 for all bytes b.
|
jpayne@69
|
499
|
jpayne@69
|
500 When the parser is finished with the encoding, then if release is
|
jpayne@69
|
501 not NULL, it will call release passing it the data member; once
|
jpayne@69
|
502 release has been called, the convert function will not be called
|
jpayne@69
|
503 again.
|
jpayne@69
|
504
|
jpayne@69
|
505 Expat places certain restrictions on the encodings that are supported
|
jpayne@69
|
506 using this mechanism.
|
jpayne@69
|
507
|
jpayne@69
|
508 1. Every ASCII character that can appear in a well-formed XML document,
|
jpayne@69
|
509 other than the characters
|
jpayne@69
|
510
|
jpayne@69
|
511 $@\^`{}~
|
jpayne@69
|
512
|
jpayne@69
|
513 must be represented by a single byte, and that byte must be the
|
jpayne@69
|
514 same byte that represents that character in ASCII.
|
jpayne@69
|
515
|
jpayne@69
|
516 2. No character may require more than 4 bytes to encode.
|
jpayne@69
|
517
|
jpayne@69
|
518 3. All characters encoded must have Unicode scalar values <=
|
jpayne@69
|
519 0xFFFF, (i.e., characters that would be encoded by surrogates in
|
jpayne@69
|
520 UTF-16 are not allowed). Note that this restriction doesn't
|
jpayne@69
|
521 apply to the built-in support for UTF-8 and UTF-16.
|
jpayne@69
|
522
|
jpayne@69
|
523 4. No Unicode character may be encoded by more than one distinct
|
jpayne@69
|
524 sequence of bytes.
|
jpayne@69
|
525 */
|
jpayne@69
|
526 typedef struct {
|
jpayne@69
|
527 int map[256];
|
jpayne@69
|
528 void *data;
|
jpayne@69
|
529 int(XMLCALL *convert)(void *data, const char *s);
|
jpayne@69
|
530 void(XMLCALL *release)(void *data);
|
jpayne@69
|
531 } XML_Encoding;
|
jpayne@69
|
532
|
jpayne@69
|
533 /* This is called for an encoding that is unknown to the parser.
|
jpayne@69
|
534
|
jpayne@69
|
535 The encodingHandlerData argument is that which was passed as the
|
jpayne@69
|
536 second argument to XML_SetUnknownEncodingHandler.
|
jpayne@69
|
537
|
jpayne@69
|
538 The name argument gives the name of the encoding as specified in
|
jpayne@69
|
539 the encoding declaration.
|
jpayne@69
|
540
|
jpayne@69
|
541 If the callback can provide information about the encoding, it must
|
jpayne@69
|
542 fill in the XML_Encoding structure, and return XML_STATUS_OK.
|
jpayne@69
|
543 Otherwise it must return XML_STATUS_ERROR.
|
jpayne@69
|
544
|
jpayne@69
|
545 If info does not describe a suitable encoding, then the parser will
|
jpayne@69
|
546 return an XML_ERROR_UNKNOWN_ENCODING error.
|
jpayne@69
|
547 */
|
jpayne@69
|
548 typedef int(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,
|
jpayne@69
|
549 const XML_Char *name,
|
jpayne@69
|
550 XML_Encoding *info);
|
jpayne@69
|
551
|
jpayne@69
|
552 XMLPARSEAPI(void)
|
jpayne@69
|
553 XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start,
|
jpayne@69
|
554 XML_EndElementHandler end);
|
jpayne@69
|
555
|
jpayne@69
|
556 XMLPARSEAPI(void)
|
jpayne@69
|
557 XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler handler);
|
jpayne@69
|
558
|
jpayne@69
|
559 XMLPARSEAPI(void)
|
jpayne@69
|
560 XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler);
|
jpayne@69
|
561
|
jpayne@69
|
562 XMLPARSEAPI(void)
|
jpayne@69
|
563 XML_SetCharacterDataHandler(XML_Parser parser,
|
jpayne@69
|
564 XML_CharacterDataHandler handler);
|
jpayne@69
|
565
|
jpayne@69
|
566 XMLPARSEAPI(void)
|
jpayne@69
|
567 XML_SetProcessingInstructionHandler(XML_Parser parser,
|
jpayne@69
|
568 XML_ProcessingInstructionHandler handler);
|
jpayne@69
|
569 XMLPARSEAPI(void)
|
jpayne@69
|
570 XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler);
|
jpayne@69
|
571
|
jpayne@69
|
572 XMLPARSEAPI(void)
|
jpayne@69
|
573 XML_SetCdataSectionHandler(XML_Parser parser,
|
jpayne@69
|
574 XML_StartCdataSectionHandler start,
|
jpayne@69
|
575 XML_EndCdataSectionHandler end);
|
jpayne@69
|
576
|
jpayne@69
|
577 XMLPARSEAPI(void)
|
jpayne@69
|
578 XML_SetStartCdataSectionHandler(XML_Parser parser,
|
jpayne@69
|
579 XML_StartCdataSectionHandler start);
|
jpayne@69
|
580
|
jpayne@69
|
581 XMLPARSEAPI(void)
|
jpayne@69
|
582 XML_SetEndCdataSectionHandler(XML_Parser parser,
|
jpayne@69
|
583 XML_EndCdataSectionHandler end);
|
jpayne@69
|
584
|
jpayne@69
|
585 /* This sets the default handler and also inhibits expansion of
|
jpayne@69
|
586 internal entities. These entity references will be passed to the
|
jpayne@69
|
587 default handler, or to the skipped entity handler, if one is set.
|
jpayne@69
|
588 */
|
jpayne@69
|
589 XMLPARSEAPI(void)
|
jpayne@69
|
590 XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler);
|
jpayne@69
|
591
|
jpayne@69
|
592 /* This sets the default handler but does not inhibit expansion of
|
jpayne@69
|
593 internal entities. The entity reference will not be passed to the
|
jpayne@69
|
594 default handler.
|
jpayne@69
|
595 */
|
jpayne@69
|
596 XMLPARSEAPI(void)
|
jpayne@69
|
597 XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler);
|
jpayne@69
|
598
|
jpayne@69
|
599 XMLPARSEAPI(void)
|
jpayne@69
|
600 XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start,
|
jpayne@69
|
601 XML_EndDoctypeDeclHandler end);
|
jpayne@69
|
602
|
jpayne@69
|
603 XMLPARSEAPI(void)
|
jpayne@69
|
604 XML_SetStartDoctypeDeclHandler(XML_Parser parser,
|
jpayne@69
|
605 XML_StartDoctypeDeclHandler start);
|
jpayne@69
|
606
|
jpayne@69
|
607 XMLPARSEAPI(void)
|
jpayne@69
|
608 XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end);
|
jpayne@69
|
609
|
jpayne@69
|
610 XMLPARSEAPI(void)
|
jpayne@69
|
611 XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
|
jpayne@69
|
612 XML_UnparsedEntityDeclHandler handler);
|
jpayne@69
|
613
|
jpayne@69
|
614 XMLPARSEAPI(void)
|
jpayne@69
|
615 XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler);
|
jpayne@69
|
616
|
jpayne@69
|
617 XMLPARSEAPI(void)
|
jpayne@69
|
618 XML_SetNamespaceDeclHandler(XML_Parser parser,
|
jpayne@69
|
619 XML_StartNamespaceDeclHandler start,
|
jpayne@69
|
620 XML_EndNamespaceDeclHandler end);
|
jpayne@69
|
621
|
jpayne@69
|
622 XMLPARSEAPI(void)
|
jpayne@69
|
623 XML_SetStartNamespaceDeclHandler(XML_Parser parser,
|
jpayne@69
|
624 XML_StartNamespaceDeclHandler start);
|
jpayne@69
|
625
|
jpayne@69
|
626 XMLPARSEAPI(void)
|
jpayne@69
|
627 XML_SetEndNamespaceDeclHandler(XML_Parser parser,
|
jpayne@69
|
628 XML_EndNamespaceDeclHandler end);
|
jpayne@69
|
629
|
jpayne@69
|
630 XMLPARSEAPI(void)
|
jpayne@69
|
631 XML_SetNotStandaloneHandler(XML_Parser parser,
|
jpayne@69
|
632 XML_NotStandaloneHandler handler);
|
jpayne@69
|
633
|
jpayne@69
|
634 XMLPARSEAPI(void)
|
jpayne@69
|
635 XML_SetExternalEntityRefHandler(XML_Parser parser,
|
jpayne@69
|
636 XML_ExternalEntityRefHandler handler);
|
jpayne@69
|
637
|
jpayne@69
|
638 /* If a non-NULL value for arg is specified here, then it will be
|
jpayne@69
|
639 passed as the first argument to the external entity ref handler
|
jpayne@69
|
640 instead of the parser object.
|
jpayne@69
|
641 */
|
jpayne@69
|
642 XMLPARSEAPI(void)
|
jpayne@69
|
643 XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg);
|
jpayne@69
|
644
|
jpayne@69
|
645 XMLPARSEAPI(void)
|
jpayne@69
|
646 XML_SetSkippedEntityHandler(XML_Parser parser,
|
jpayne@69
|
647 XML_SkippedEntityHandler handler);
|
jpayne@69
|
648
|
jpayne@69
|
649 XMLPARSEAPI(void)
|
jpayne@69
|
650 XML_SetUnknownEncodingHandler(XML_Parser parser,
|
jpayne@69
|
651 XML_UnknownEncodingHandler handler,
|
jpayne@69
|
652 void *encodingHandlerData);
|
jpayne@69
|
653
|
jpayne@69
|
654 /* This can be called within a handler for a start element, end
|
jpayne@69
|
655 element, processing instruction or character data. It causes the
|
jpayne@69
|
656 corresponding markup to be passed to the default handler.
|
jpayne@69
|
657 */
|
jpayne@69
|
658 XMLPARSEAPI(void)
|
jpayne@69
|
659 XML_DefaultCurrent(XML_Parser parser);
|
jpayne@69
|
660
|
jpayne@69
|
661 /* If do_nst is non-zero, and namespace processing is in effect, and
|
jpayne@69
|
662 a name has a prefix (i.e. an explicit namespace qualifier) then
|
jpayne@69
|
663 that name is returned as a triplet in a single string separated by
|
jpayne@69
|
664 the separator character specified when the parser was created: URI
|
jpayne@69
|
665 + sep + local_name + sep + prefix.
|
jpayne@69
|
666
|
jpayne@69
|
667 If do_nst is zero, then namespace information is returned in the
|
jpayne@69
|
668 default manner (URI + sep + local_name) whether or not the name
|
jpayne@69
|
669 has a prefix.
|
jpayne@69
|
670
|
jpayne@69
|
671 Note: Calling XML_SetReturnNSTriplet after XML_Parse or
|
jpayne@69
|
672 XML_ParseBuffer has no effect.
|
jpayne@69
|
673 */
|
jpayne@69
|
674
|
jpayne@69
|
675 XMLPARSEAPI(void)
|
jpayne@69
|
676 XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
|
jpayne@69
|
677
|
jpayne@69
|
678 /* This value is passed as the userData argument to callbacks. */
|
jpayne@69
|
679 XMLPARSEAPI(void)
|
jpayne@69
|
680 XML_SetUserData(XML_Parser parser, void *userData);
|
jpayne@69
|
681
|
jpayne@69
|
682 /* Returns the last value set by XML_SetUserData or NULL. */
|
jpayne@69
|
683 #define XML_GetUserData(parser) (*(void **)(parser))
|
jpayne@69
|
684
|
jpayne@69
|
685 /* This is equivalent to supplying an encoding argument to
|
jpayne@69
|
686 XML_ParserCreate. On success XML_SetEncoding returns non-zero,
|
jpayne@69
|
687 zero otherwise.
|
jpayne@69
|
688 Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer
|
jpayne@69
|
689 has no effect and returns XML_STATUS_ERROR.
|
jpayne@69
|
690 */
|
jpayne@69
|
691 XMLPARSEAPI(enum XML_Status)
|
jpayne@69
|
692 XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
|
jpayne@69
|
693
|
jpayne@69
|
694 /* If this function is called, then the parser will be passed as the
|
jpayne@69
|
695 first argument to callbacks instead of userData. The userData will
|
jpayne@69
|
696 still be accessible using XML_GetUserData.
|
jpayne@69
|
697 */
|
jpayne@69
|
698 XMLPARSEAPI(void)
|
jpayne@69
|
699 XML_UseParserAsHandlerArg(XML_Parser parser);
|
jpayne@69
|
700
|
jpayne@69
|
701 /* If useDTD == XML_TRUE is passed to this function, then the parser
|
jpayne@69
|
702 will assume that there is an external subset, even if none is
|
jpayne@69
|
703 specified in the document. In such a case the parser will call the
|
jpayne@69
|
704 externalEntityRefHandler with a value of NULL for the systemId
|
jpayne@69
|
705 argument (the publicId and context arguments will be NULL as well).
|
jpayne@69
|
706 Note: For the purpose of checking WFC: Entity Declared, passing
|
jpayne@69
|
707 useDTD == XML_TRUE will make the parser behave as if the document
|
jpayne@69
|
708 had a DTD with an external subset.
|
jpayne@69
|
709 Note: If this function is called, then this must be done before
|
jpayne@69
|
710 the first call to XML_Parse or XML_ParseBuffer, since it will
|
jpayne@69
|
711 have no effect after that. Returns
|
jpayne@69
|
712 XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING.
|
jpayne@69
|
713 Note: If the document does not have a DOCTYPE declaration at all,
|
jpayne@69
|
714 then startDoctypeDeclHandler and endDoctypeDeclHandler will not
|
jpayne@69
|
715 be called, despite an external subset being parsed.
|
jpayne@69
|
716 Note: If XML_DTD is not defined when Expat is compiled, returns
|
jpayne@69
|
717 XML_ERROR_FEATURE_REQUIRES_XML_DTD.
|
jpayne@69
|
718 Note: If parser == NULL, returns XML_ERROR_INVALID_ARGUMENT.
|
jpayne@69
|
719 */
|
jpayne@69
|
720 XMLPARSEAPI(enum XML_Error)
|
jpayne@69
|
721 XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
|
jpayne@69
|
722
|
jpayne@69
|
723 /* Sets the base to be used for resolving relative URIs in system
|
jpayne@69
|
724 identifiers in declarations. Resolving relative identifiers is
|
jpayne@69
|
725 left to the application: this value will be passed through as the
|
jpayne@69
|
726 base argument to the XML_ExternalEntityRefHandler,
|
jpayne@69
|
727 XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base
|
jpayne@69
|
728 argument will be copied. Returns XML_STATUS_ERROR if out of memory,
|
jpayne@69
|
729 XML_STATUS_OK otherwise.
|
jpayne@69
|
730 */
|
jpayne@69
|
731 XMLPARSEAPI(enum XML_Status)
|
jpayne@69
|
732 XML_SetBase(XML_Parser parser, const XML_Char *base);
|
jpayne@69
|
733
|
jpayne@69
|
734 XMLPARSEAPI(const XML_Char *)
|
jpayne@69
|
735 XML_GetBase(XML_Parser parser);
|
jpayne@69
|
736
|
jpayne@69
|
737 /* Returns the number of the attribute/value pairs passed in last call
|
jpayne@69
|
738 to the XML_StartElementHandler that were specified in the start-tag
|
jpayne@69
|
739 rather than defaulted. Each attribute/value pair counts as 2; thus
|
jpayne@69
|
740 this corresponds to an index into the atts array passed to the
|
jpayne@69
|
741 XML_StartElementHandler. Returns -1 if parser == NULL.
|
jpayne@69
|
742 */
|
jpayne@69
|
743 XMLPARSEAPI(int)
|
jpayne@69
|
744 XML_GetSpecifiedAttributeCount(XML_Parser parser);
|
jpayne@69
|
745
|
jpayne@69
|
746 /* Returns the index of the ID attribute passed in the last call to
|
jpayne@69
|
747 XML_StartElementHandler, or -1 if there is no ID attribute or
|
jpayne@69
|
748 parser == NULL. Each attribute/value pair counts as 2; thus this
|
jpayne@69
|
749 corresponds to an index into the atts array passed to the
|
jpayne@69
|
750 XML_StartElementHandler.
|
jpayne@69
|
751 */
|
jpayne@69
|
752 XMLPARSEAPI(int)
|
jpayne@69
|
753 XML_GetIdAttributeIndex(XML_Parser parser);
|
jpayne@69
|
754
|
jpayne@69
|
755 #ifdef XML_ATTR_INFO
|
jpayne@69
|
756 /* Source file byte offsets for the start and end of attribute names and values.
|
jpayne@69
|
757 The value indices are exclusive of surrounding quotes; thus in a UTF-8 source
|
jpayne@69
|
758 file an attribute value of "blah" will yield:
|
jpayne@69
|
759 info->valueEnd - info->valueStart = 4 bytes.
|
jpayne@69
|
760 */
|
jpayne@69
|
761 typedef struct {
|
jpayne@69
|
762 XML_Index nameStart; /* Offset to beginning of the attribute name. */
|
jpayne@69
|
763 XML_Index nameEnd; /* Offset after the attribute name's last byte. */
|
jpayne@69
|
764 XML_Index valueStart; /* Offset to beginning of the attribute value. */
|
jpayne@69
|
765 XML_Index valueEnd; /* Offset after the attribute value's last byte. */
|
jpayne@69
|
766 } XML_AttrInfo;
|
jpayne@69
|
767
|
jpayne@69
|
768 /* Returns an array of XML_AttrInfo structures for the attribute/value pairs
|
jpayne@69
|
769 passed in last call to the XML_StartElementHandler that were specified
|
jpayne@69
|
770 in the start-tag rather than defaulted. Each attribute/value pair counts
|
jpayne@69
|
771 as 1; thus the number of entries in the array is
|
jpayne@69
|
772 XML_GetSpecifiedAttributeCount(parser) / 2.
|
jpayne@69
|
773 */
|
jpayne@69
|
774 XMLPARSEAPI(const XML_AttrInfo *)
|
jpayne@69
|
775 XML_GetAttributeInfo(XML_Parser parser);
|
jpayne@69
|
776 #endif
|
jpayne@69
|
777
|
jpayne@69
|
778 /* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
|
jpayne@69
|
779 detected. The last call to XML_Parse must have isFinal true; len
|
jpayne@69
|
780 may be zero for this call (or any other).
|
jpayne@69
|
781
|
jpayne@69
|
782 Though the return values for these functions has always been
|
jpayne@69
|
783 described as a Boolean value, the implementation, at least for the
|
jpayne@69
|
784 1.95.x series, has always returned exactly one of the XML_Status
|
jpayne@69
|
785 values.
|
jpayne@69
|
786 */
|
jpayne@69
|
787 XMLPARSEAPI(enum XML_Status)
|
jpayne@69
|
788 XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
|
jpayne@69
|
789
|
jpayne@69
|
790 XMLPARSEAPI(void *)
|
jpayne@69
|
791 XML_GetBuffer(XML_Parser parser, int len);
|
jpayne@69
|
792
|
jpayne@69
|
793 XMLPARSEAPI(enum XML_Status)
|
jpayne@69
|
794 XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
|
jpayne@69
|
795
|
jpayne@69
|
796 /* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return.
|
jpayne@69
|
797 Must be called from within a call-back handler, except when aborting
|
jpayne@69
|
798 (resumable = 0) an already suspended parser. Some call-backs may
|
jpayne@69
|
799 still follow because they would otherwise get lost. Examples:
|
jpayne@69
|
800 - endElementHandler() for empty elements when stopped in
|
jpayne@69
|
801 startElementHandler(),
|
jpayne@69
|
802 - endNameSpaceDeclHandler() when stopped in endElementHandler(),
|
jpayne@69
|
803 and possibly others.
|
jpayne@69
|
804
|
jpayne@69
|
805 Can be called from most handlers, including DTD related call-backs,
|
jpayne@69
|
806 except when parsing an external parameter entity and resumable != 0.
|
jpayne@69
|
807 Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise.
|
jpayne@69
|
808 Possible error codes:
|
jpayne@69
|
809 - XML_ERROR_SUSPENDED: when suspending an already suspended parser.
|
jpayne@69
|
810 - XML_ERROR_FINISHED: when the parser has already finished.
|
jpayne@69
|
811 - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE.
|
jpayne@69
|
812
|
jpayne@69
|
813 When resumable != 0 (true) then parsing is suspended, that is,
|
jpayne@69
|
814 XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED.
|
jpayne@69
|
815 Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer()
|
jpayne@69
|
816 return XML_STATUS_ERROR with error code XML_ERROR_ABORTED.
|
jpayne@69
|
817
|
jpayne@69
|
818 *Note*:
|
jpayne@69
|
819 This will be applied to the current parser instance only, that is, if
|
jpayne@69
|
820 there is a parent parser then it will continue parsing when the
|
jpayne@69
|
821 externalEntityRefHandler() returns. It is up to the implementation of
|
jpayne@69
|
822 the externalEntityRefHandler() to call XML_StopParser() on the parent
|
jpayne@69
|
823 parser (recursively), if one wants to stop parsing altogether.
|
jpayne@69
|
824
|
jpayne@69
|
825 When suspended, parsing can be resumed by calling XML_ResumeParser().
|
jpayne@69
|
826 */
|
jpayne@69
|
827 XMLPARSEAPI(enum XML_Status)
|
jpayne@69
|
828 XML_StopParser(XML_Parser parser, XML_Bool resumable);
|
jpayne@69
|
829
|
jpayne@69
|
830 /* Resumes parsing after it has been suspended with XML_StopParser().
|
jpayne@69
|
831 Must not be called from within a handler call-back. Returns same
|
jpayne@69
|
832 status codes as XML_Parse() or XML_ParseBuffer().
|
jpayne@69
|
833 Additional error code XML_ERROR_NOT_SUSPENDED possible.
|
jpayne@69
|
834
|
jpayne@69
|
835 *Note*:
|
jpayne@69
|
836 This must be called on the most deeply nested child parser instance
|
jpayne@69
|
837 first, and on its parent parser only after the child parser has finished,
|
jpayne@69
|
838 to be applied recursively until the document entity's parser is restarted.
|
jpayne@69
|
839 That is, the parent parser will not resume by itself and it is up to the
|
jpayne@69
|
840 application to call XML_ResumeParser() on it at the appropriate moment.
|
jpayne@69
|
841 */
|
jpayne@69
|
842 XMLPARSEAPI(enum XML_Status)
|
jpayne@69
|
843 XML_ResumeParser(XML_Parser parser);
|
jpayne@69
|
844
|
jpayne@69
|
845 enum XML_Parsing { XML_INITIALIZED, XML_PARSING, XML_FINISHED, XML_SUSPENDED };
|
jpayne@69
|
846
|
jpayne@69
|
847 typedef struct {
|
jpayne@69
|
848 enum XML_Parsing parsing;
|
jpayne@69
|
849 XML_Bool finalBuffer;
|
jpayne@69
|
850 } XML_ParsingStatus;
|
jpayne@69
|
851
|
jpayne@69
|
852 /* Returns status of parser with respect to being initialized, parsing,
|
jpayne@69
|
853 finished, or suspended and processing the final buffer.
|
jpayne@69
|
854 XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus,
|
jpayne@69
|
855 XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED
|
jpayne@69
|
856 */
|
jpayne@69
|
857 XMLPARSEAPI(void)
|
jpayne@69
|
858 XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
|
jpayne@69
|
859
|
jpayne@69
|
860 /* Creates an XML_Parser object that can parse an external general
|
jpayne@69
|
861 entity; context is a '\0'-terminated string specifying the parse
|
jpayne@69
|
862 context; encoding is a '\0'-terminated string giving the name of
|
jpayne@69
|
863 the externally specified encoding, or NULL if there is no
|
jpayne@69
|
864 externally specified encoding. The context string consists of a
|
jpayne@69
|
865 sequence of tokens separated by formfeeds (\f); a token consisting
|
jpayne@69
|
866 of a name specifies that the general entity of the name is open; a
|
jpayne@69
|
867 token of the form prefix=uri specifies the namespace for a
|
jpayne@69
|
868 particular prefix; a token of the form =uri specifies the default
|
jpayne@69
|
869 namespace. This can be called at any point after the first call to
|
jpayne@69
|
870 an ExternalEntityRefHandler so longer as the parser has not yet
|
jpayne@69
|
871 been freed. The new parser is completely independent and may
|
jpayne@69
|
872 safely be used in a separate thread. The handlers and userData are
|
jpayne@69
|
873 initialized from the parser argument. Returns NULL if out of memory.
|
jpayne@69
|
874 Otherwise returns a new XML_Parser object.
|
jpayne@69
|
875 */
|
jpayne@69
|
876 XMLPARSEAPI(XML_Parser)
|
jpayne@69
|
877 XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context,
|
jpayne@69
|
878 const XML_Char *encoding);
|
jpayne@69
|
879
|
jpayne@69
|
880 enum XML_ParamEntityParsing {
|
jpayne@69
|
881 XML_PARAM_ENTITY_PARSING_NEVER,
|
jpayne@69
|
882 XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
|
jpayne@69
|
883 XML_PARAM_ENTITY_PARSING_ALWAYS
|
jpayne@69
|
884 };
|
jpayne@69
|
885
|
jpayne@69
|
886 /* Controls parsing of parameter entities (including the external DTD
|
jpayne@69
|
887 subset). If parsing of parameter entities is enabled, then
|
jpayne@69
|
888 references to external parameter entities (including the external
|
jpayne@69
|
889 DTD subset) will be passed to the handler set with
|
jpayne@69
|
890 XML_SetExternalEntityRefHandler. The context passed will be 0.
|
jpayne@69
|
891
|
jpayne@69
|
892 Unlike external general entities, external parameter entities can
|
jpayne@69
|
893 only be parsed synchronously. If the external parameter entity is
|
jpayne@69
|
894 to be parsed, it must be parsed during the call to the external
|
jpayne@69
|
895 entity ref handler: the complete sequence of
|
jpayne@69
|
896 XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and
|
jpayne@69
|
897 XML_ParserFree calls must be made during this call. After
|
jpayne@69
|
898 XML_ExternalEntityParserCreate has been called to create the parser
|
jpayne@69
|
899 for the external parameter entity (context must be 0 for this
|
jpayne@69
|
900 call), it is illegal to make any calls on the old parser until
|
jpayne@69
|
901 XML_ParserFree has been called on the newly created parser.
|
jpayne@69
|
902 If the library has been compiled without support for parameter
|
jpayne@69
|
903 entity parsing (ie without XML_DTD being defined), then
|
jpayne@69
|
904 XML_SetParamEntityParsing will return 0 if parsing of parameter
|
jpayne@69
|
905 entities is requested; otherwise it will return non-zero.
|
jpayne@69
|
906 Note: If XML_SetParamEntityParsing is called after XML_Parse or
|
jpayne@69
|
907 XML_ParseBuffer, then it has no effect and will always return 0.
|
jpayne@69
|
908 Note: If parser == NULL, the function will do nothing and return 0.
|
jpayne@69
|
909 */
|
jpayne@69
|
910 XMLPARSEAPI(int)
|
jpayne@69
|
911 XML_SetParamEntityParsing(XML_Parser parser,
|
jpayne@69
|
912 enum XML_ParamEntityParsing parsing);
|
jpayne@69
|
913
|
jpayne@69
|
914 /* Sets the hash salt to use for internal hash calculations.
|
jpayne@69
|
915 Helps in preventing DoS attacks based on predicting hash
|
jpayne@69
|
916 function behavior. This must be called before parsing is started.
|
jpayne@69
|
917 Returns 1 if successful, 0 when called after parsing has started.
|
jpayne@69
|
918 Note: If parser == NULL, the function will do nothing and return 0.
|
jpayne@69
|
919 */
|
jpayne@69
|
920 XMLPARSEAPI(int)
|
jpayne@69
|
921 XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt);
|
jpayne@69
|
922
|
jpayne@69
|
923 /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
|
jpayne@69
|
924 XML_GetErrorCode returns information about the error.
|
jpayne@69
|
925 */
|
jpayne@69
|
926 XMLPARSEAPI(enum XML_Error)
|
jpayne@69
|
927 XML_GetErrorCode(XML_Parser parser);
|
jpayne@69
|
928
|
jpayne@69
|
929 /* These functions return information about the current parse
|
jpayne@69
|
930 location. They may be called from any callback called to report
|
jpayne@69
|
931 some parse event; in this case the location is the location of the
|
jpayne@69
|
932 first of the sequence of characters that generated the event. When
|
jpayne@69
|
933 called from callbacks generated by declarations in the document
|
jpayne@69
|
934 prologue, the location identified isn't as neatly defined, but will
|
jpayne@69
|
935 be within the relevant markup. When called outside of the callback
|
jpayne@69
|
936 functions, the position indicated will be just past the last parse
|
jpayne@69
|
937 event (regardless of whether there was an associated callback).
|
jpayne@69
|
938
|
jpayne@69
|
939 They may also be called after returning from a call to XML_Parse
|
jpayne@69
|
940 or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then
|
jpayne@69
|
941 the location is the location of the character at which the error
|
jpayne@69
|
942 was detected; otherwise the location is the location of the last
|
jpayne@69
|
943 parse event, as described above.
|
jpayne@69
|
944
|
jpayne@69
|
945 Note: XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber
|
jpayne@69
|
946 return 0 to indicate an error.
|
jpayne@69
|
947 Note: XML_GetCurrentByteIndex returns -1 to indicate an error.
|
jpayne@69
|
948 */
|
jpayne@69
|
949 XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser);
|
jpayne@69
|
950 XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser);
|
jpayne@69
|
951 XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);
|
jpayne@69
|
952
|
jpayne@69
|
953 /* Return the number of bytes in the current event.
|
jpayne@69
|
954 Returns 0 if the event is in an internal entity.
|
jpayne@69
|
955 */
|
jpayne@69
|
956 XMLPARSEAPI(int)
|
jpayne@69
|
957 XML_GetCurrentByteCount(XML_Parser parser);
|
jpayne@69
|
958
|
jpayne@69
|
959 /* If XML_CONTEXT_BYTES is >=1, returns the input buffer, sets
|
jpayne@69
|
960 the integer pointed to by offset to the offset within this buffer
|
jpayne@69
|
961 of the current parse position, and sets the integer pointed to by size
|
jpayne@69
|
962 to the size of this buffer (the number of input bytes). Otherwise
|
jpayne@69
|
963 returns a NULL pointer. Also returns a NULL pointer if a parse isn't
|
jpayne@69
|
964 active.
|
jpayne@69
|
965
|
jpayne@69
|
966 NOTE: The character pointer returned should not be used outside
|
jpayne@69
|
967 the handler that makes the call.
|
jpayne@69
|
968 */
|
jpayne@69
|
969 XMLPARSEAPI(const char *)
|
jpayne@69
|
970 XML_GetInputContext(XML_Parser parser, int *offset, int *size);
|
jpayne@69
|
971
|
jpayne@69
|
972 /* For backwards compatibility with previous versions. */
|
jpayne@69
|
973 #define XML_GetErrorLineNumber XML_GetCurrentLineNumber
|
jpayne@69
|
974 #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
|
jpayne@69
|
975 #define XML_GetErrorByteIndex XML_GetCurrentByteIndex
|
jpayne@69
|
976
|
jpayne@69
|
977 /* Frees the content model passed to the element declaration handler */
|
jpayne@69
|
978 XMLPARSEAPI(void)
|
jpayne@69
|
979 XML_FreeContentModel(XML_Parser parser, XML_Content *model);
|
jpayne@69
|
980
|
jpayne@69
|
981 /* Exposing the memory handling functions used in Expat */
|
jpayne@69
|
982 XMLPARSEAPI(void *)
|
jpayne@69
|
983 XML_ATTR_MALLOC
|
jpayne@69
|
984 XML_ATTR_ALLOC_SIZE(2)
|
jpayne@69
|
985 XML_MemMalloc(XML_Parser parser, size_t size);
|
jpayne@69
|
986
|
jpayne@69
|
987 XMLPARSEAPI(void *)
|
jpayne@69
|
988 XML_ATTR_ALLOC_SIZE(3)
|
jpayne@69
|
989 XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
|
jpayne@69
|
990
|
jpayne@69
|
991 XMLPARSEAPI(void)
|
jpayne@69
|
992 XML_MemFree(XML_Parser parser, void *ptr);
|
jpayne@69
|
993
|
jpayne@69
|
994 /* Frees memory used by the parser. */
|
jpayne@69
|
995 XMLPARSEAPI(void)
|
jpayne@69
|
996 XML_ParserFree(XML_Parser parser);
|
jpayne@69
|
997
|
jpayne@69
|
998 /* Returns a string describing the error. */
|
jpayne@69
|
999 XMLPARSEAPI(const XML_LChar *)
|
jpayne@69
|
1000 XML_ErrorString(enum XML_Error code);
|
jpayne@69
|
1001
|
jpayne@69
|
1002 /* Return a string containing the version number of this expat */
|
jpayne@69
|
1003 XMLPARSEAPI(const XML_LChar *)
|
jpayne@69
|
1004 XML_ExpatVersion(void);
|
jpayne@69
|
1005
|
jpayne@69
|
1006 typedef struct {
|
jpayne@69
|
1007 int major;
|
jpayne@69
|
1008 int minor;
|
jpayne@69
|
1009 int micro;
|
jpayne@69
|
1010 } XML_Expat_Version;
|
jpayne@69
|
1011
|
jpayne@69
|
1012 /* Return an XML_Expat_Version structure containing numeric version
|
jpayne@69
|
1013 number information for this version of expat.
|
jpayne@69
|
1014 */
|
jpayne@69
|
1015 XMLPARSEAPI(XML_Expat_Version)
|
jpayne@69
|
1016 XML_ExpatVersionInfo(void);
|
jpayne@69
|
1017
|
jpayne@69
|
1018 /* Added in Expat 1.95.5. */
|
jpayne@69
|
1019 enum XML_FeatureEnum {
|
jpayne@69
|
1020 XML_FEATURE_END = 0,
|
jpayne@69
|
1021 XML_FEATURE_UNICODE,
|
jpayne@69
|
1022 XML_FEATURE_UNICODE_WCHAR_T,
|
jpayne@69
|
1023 XML_FEATURE_DTD,
|
jpayne@69
|
1024 XML_FEATURE_CONTEXT_BYTES,
|
jpayne@69
|
1025 XML_FEATURE_MIN_SIZE,
|
jpayne@69
|
1026 XML_FEATURE_SIZEOF_XML_CHAR,
|
jpayne@69
|
1027 XML_FEATURE_SIZEOF_XML_LCHAR,
|
jpayne@69
|
1028 XML_FEATURE_NS,
|
jpayne@69
|
1029 XML_FEATURE_LARGE_SIZE,
|
jpayne@69
|
1030 XML_FEATURE_ATTR_INFO,
|
jpayne@69
|
1031 /* Added in Expat 2.4.0. */
|
jpayne@69
|
1032 XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT,
|
jpayne@69
|
1033 XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT,
|
jpayne@69
|
1034 /* Added in Expat 2.6.0. */
|
jpayne@69
|
1035 XML_FEATURE_GE
|
jpayne@69
|
1036 /* Additional features must be added to the end of this enum. */
|
jpayne@69
|
1037 };
|
jpayne@69
|
1038
|
jpayne@69
|
1039 typedef struct {
|
jpayne@69
|
1040 enum XML_FeatureEnum feature;
|
jpayne@69
|
1041 const XML_LChar *name;
|
jpayne@69
|
1042 long int value;
|
jpayne@69
|
1043 } XML_Feature;
|
jpayne@69
|
1044
|
jpayne@69
|
1045 XMLPARSEAPI(const XML_Feature *)
|
jpayne@69
|
1046 XML_GetFeatureList(void);
|
jpayne@69
|
1047
|
jpayne@69
|
1048 #if defined(XML_DTD) || (defined(XML_GE) && XML_GE == 1)
|
jpayne@69
|
1049 /* Added in Expat 2.4.0 for XML_DTD defined and
|
jpayne@69
|
1050 * added in Expat 2.6.0 for XML_GE == 1. */
|
jpayne@69
|
1051 XMLPARSEAPI(XML_Bool)
|
jpayne@69
|
1052 XML_SetBillionLaughsAttackProtectionMaximumAmplification(
|
jpayne@69
|
1053 XML_Parser parser, float maximumAmplificationFactor);
|
jpayne@69
|
1054
|
jpayne@69
|
1055 /* Added in Expat 2.4.0 for XML_DTD defined and
|
jpayne@69
|
1056 * added in Expat 2.6.0 for XML_GE == 1. */
|
jpayne@69
|
1057 XMLPARSEAPI(XML_Bool)
|
jpayne@69
|
1058 XML_SetBillionLaughsAttackProtectionActivationThreshold(
|
jpayne@69
|
1059 XML_Parser parser, unsigned long long activationThresholdBytes);
|
jpayne@69
|
1060 #endif
|
jpayne@69
|
1061
|
jpayne@69
|
1062 /* Added in Expat 2.6.0. */
|
jpayne@69
|
1063 XMLPARSEAPI(XML_Bool)
|
jpayne@69
|
1064 XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled);
|
jpayne@69
|
1065
|
jpayne@69
|
1066 /* Expat follows the semantic versioning convention.
|
jpayne@69
|
1067 See https://semver.org
|
jpayne@69
|
1068 */
|
jpayne@69
|
1069 #define XML_MAJOR_VERSION 2
|
jpayne@69
|
1070 #define XML_MINOR_VERSION 6
|
jpayne@69
|
1071 #define XML_MICRO_VERSION 4
|
jpayne@69
|
1072
|
jpayne@69
|
1073 #ifdef __cplusplus
|
jpayne@69
|
1074 }
|
jpayne@69
|
1075 #endif
|
jpayne@69
|
1076
|
jpayne@69
|
1077 #endif /* not Expat_INCLUDED */
|