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