1 #ifndef LIBRARIES_EXPAT_H
2 #define LIBRARIES_EXPAT_H
5 ** Copyright (c) 2001-2007 Expat maintainers.
7 ** Permission is hereby granted, free of charge, to any person obtaining
8 ** a copy of this software and associated documentation files (the
9 ** "Software"), to deal in the Software without restriction, including
10 ** without limitation the rights to use, copy, modify, merge, publish,
11 ** distribute, sublicense, and/or sell copies of the Software, and to
12 ** permit persons to whom the Software is furnished to do so, subject to
13 ** the following conditions:
15 ** The above copyright notice and this permission notice shall be included
16 ** in all copies or substantial portions of the Software.
18 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 /****************************************************************************/
38 #elif defined(__VBCC__)
42 /****************************************************************************/
51 typedef char XML_Char
;
52 typedef char XML_LChar
;
53 typedef long XML_Index
;
54 typedef unsigned long XML_Size
;
56 struct XML_ParserStruct
;
57 typedef struct XML_ParserStruct
*XML_Parser
;
59 typedef unsigned char XML_Bool
;
60 #define XML_TRUE ((XML_Bool) 1)
61 #define XML_FALSE ((XML_Bool) 0)
65 #define XML_STATUS_ERROR XML_STATUS_ERROR
67 #define XML_STATUS_OK XML_STATUS_OK
68 XML_STATUS_SUSPENDED
= 2,
69 #define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
76 XML_ERROR_NO_ELEMENTS
,
77 XML_ERROR_INVALID_TOKEN
,
78 XML_ERROR_UNCLOSED_TOKEN
,
79 XML_ERROR_PARTIAL_CHAR
,
80 XML_ERROR_TAG_MISMATCH
,
81 XML_ERROR_DUPLICATE_ATTRIBUTE
,
82 XML_ERROR_JUNK_AFTER_DOC_ELEMENT
,
83 XML_ERROR_PARAM_ENTITY_REF
,
84 XML_ERROR_UNDEFINED_ENTITY
,
85 XML_ERROR_RECURSIVE_ENTITY_REF
,
86 XML_ERROR_ASYNC_ENTITY
,
87 XML_ERROR_BAD_CHAR_REF
,
88 XML_ERROR_BINARY_ENTITY_REF
,
89 XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF
,
90 XML_ERROR_MISPLACED_XML_PI
,
91 XML_ERROR_UNKNOWN_ENCODING
,
92 XML_ERROR_INCORRECT_ENCODING
,
93 XML_ERROR_UNCLOSED_CDATA_SECTION
,
94 XML_ERROR_EXTERNAL_ENTITY_HANDLING
,
95 XML_ERROR_NOT_STANDALONE
,
96 XML_ERROR_UNEXPECTED_STATE
,
97 XML_ERROR_ENTITY_DECLARED_IN_PE
,
98 XML_ERROR_FEATURE_REQUIRES_XML_DTD
,
99 XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING
,
100 XML_ERROR_UNBOUND_PREFIX
,
101 XML_ERROR_UNDECLARING_PREFIX
,
102 XML_ERROR_INCOMPLETE_PE
,
107 XML_ERROR_NOT_SUSPENDED
,
110 XML_ERROR_SUSPEND_PE
,
111 XML_ERROR_RESERVED_PREFIX_XML
,
112 XML_ERROR_RESERVED_PREFIX_XMLNS
,
113 XML_ERROR_RESERVED_NAMESPACE_URI
116 enum XML_Content_Type
{
125 enum XML_Content_Quant
{
132 typedef struct XML_cp XML_Content
;
135 enum XML_Content_Type type
;
136 enum XML_Content_Quant quant
;
138 unsigned int numchildren
;
139 XML_Content
* children
;
143 typedef void (*XML_ElementDeclHandler
) (void *userData
,
144 const XML_Char
*name
,
148 XML_SetElementDeclHandler(XML_Parser parser
,
149 XML_ElementDeclHandler eldecl
);
151 typedef void (*XML_AttlistDeclHandler
) (
153 const XML_Char
*elname
,
154 const XML_Char
*attname
,
155 const XML_Char
*att_type
,
156 const XML_Char
*dflt
,
160 XML_SetAttlistDeclHandler(XML_Parser parser
,
161 XML_AttlistDeclHandler attdecl
);
163 typedef void (*XML_XmlDeclHandler
) (void *userData
,
164 const XML_Char
*version
,
165 const XML_Char
*encoding
,
169 XML_SetXmlDeclHandler(XML_Parser parser
,
170 XML_XmlDeclHandler xmldecl
);
174 void *(*malloc_fcn
)(size_t size
);
175 void *(*realloc_fcn
)(void *ptr
, size_t size
);
176 void (*free_fcn
)(void *ptr
);
177 } XML_Memory_Handling_Suite
;
180 XML_ParserCreate(const XML_Char
*encoding
);
183 XML_ParserCreateNS(const XML_Char
*encoding
, XML_Char namespaceSeparator
);
187 XML_ParserCreate_MM(const XML_Char
*encoding
,
188 const XML_Memory_Handling_Suite
*memsuite
,
189 const XML_Char
*namespaceSeparator
);
192 XML_ParserReset(XML_Parser parser
, const XML_Char
*encoding
);
194 typedef void (*XML_StartElementHandler
) (void *userData
,
195 const XML_Char
*name
,
196 const XML_Char
**atts
);
198 typedef void (*XML_EndElementHandler
) (void *userData
,
199 const XML_Char
*name
);
202 typedef void (*XML_CharacterDataHandler
) (void *userData
,
206 typedef void (*XML_ProcessingInstructionHandler
) (
208 const XML_Char
*target
,
209 const XML_Char
*data
);
211 typedef void (*XML_CommentHandler
) (void *userData
,
212 const XML_Char
*data
);
214 typedef void (*XML_StartCdataSectionHandler
) (void *userData
);
215 typedef void (*XML_EndCdataSectionHandler
) (void *userData
);
217 typedef void (*XML_DefaultHandler
) (void *userData
,
221 typedef void (*XML_StartDoctypeDeclHandler
) (
223 const XML_Char
*doctypeName
,
224 const XML_Char
*sysid
,
225 const XML_Char
*pubid
,
226 int has_internal_subset
);
228 typedef void (*XML_EndDoctypeDeclHandler
)(void *userData
);
230 typedef void (*XML_EntityDeclHandler
) (
232 const XML_Char
*entityName
,
233 int is_parameter_entity
,
234 const XML_Char
*value
,
236 const XML_Char
*base
,
237 const XML_Char
*systemId
,
238 const XML_Char
*publicId
,
239 const XML_Char
*notationName
);
242 XML_SetEntityDeclHandler(XML_Parser parser
,
243 XML_EntityDeclHandler handler
);
245 typedef void (*XML_UnparsedEntityDeclHandler
) (
247 const XML_Char
*entityName
,
248 const XML_Char
*base
,
249 const XML_Char
*systemId
,
250 const XML_Char
*publicId
,
251 const XML_Char
*notationName
);
253 typedef void (*XML_NotationDeclHandler
) (
255 const XML_Char
*notationName
,
256 const XML_Char
*base
,
257 const XML_Char
*systemId
,
258 const XML_Char
*publicId
);
260 typedef void (*XML_StartNamespaceDeclHandler
) (
262 const XML_Char
*prefix
,
263 const XML_Char
*uri
);
265 typedef void (*XML_EndNamespaceDeclHandler
) (
267 const XML_Char
*prefix
);
269 typedef int (*XML_NotStandaloneHandler
) (void *userData
);
271 typedef int (*XML_ExternalEntityRefHandler
) (
273 const XML_Char
*context
,
274 const XML_Char
*base
,
275 const XML_Char
*systemId
,
276 const XML_Char
*publicId
);
278 typedef void (*XML_SkippedEntityHandler
) (
280 const XML_Char
*entityName
,
281 int is_parameter_entity
);
286 int (*convert
)(void *data
, const char *s
);
287 void (*release
)(void *data
);
290 typedef int (*XML_UnknownEncodingHandler
) (
291 void *encodingHandlerData
,
292 const XML_Char
*name
,
296 XML_SetElementHandler(XML_Parser parser
,
297 XML_StartElementHandler start
,
298 XML_EndElementHandler end
);
301 XML_SetStartElementHandler(XML_Parser parser
,
302 XML_StartElementHandler handler
);
305 XML_SetEndElementHandler(XML_Parser parser
,
306 XML_EndElementHandler handler
);
309 XML_SetCharacterDataHandler(XML_Parser parser
,
310 XML_CharacterDataHandler handler
);
313 XML_SetProcessingInstructionHandler(XML_Parser parser
,
314 XML_ProcessingInstructionHandler handler
);
316 XML_SetCommentHandler(XML_Parser parser
,
317 XML_CommentHandler handler
);
320 XML_SetCdataSectionHandler(XML_Parser parser
,
321 XML_StartCdataSectionHandler start
,
322 XML_EndCdataSectionHandler end
);
325 XML_SetStartCdataSectionHandler(XML_Parser parser
,
326 XML_StartCdataSectionHandler start
);
329 XML_SetEndCdataSectionHandler(XML_Parser parser
,
330 XML_EndCdataSectionHandler end
);
333 XML_SetDefaultHandler(XML_Parser parser
,
334 XML_DefaultHandler handler
);
337 XML_SetDefaultHandlerExpand(XML_Parser parser
,
338 XML_DefaultHandler handler
);
341 XML_SetDoctypeDeclHandler(XML_Parser parser
,
342 XML_StartDoctypeDeclHandler start
,
343 XML_EndDoctypeDeclHandler end
);
346 XML_SetStartDoctypeDeclHandler(XML_Parser parser
,
347 XML_StartDoctypeDeclHandler start
);
350 XML_SetEndDoctypeDeclHandler(XML_Parser parser
,
351 XML_EndDoctypeDeclHandler end
);
354 XML_SetUnparsedEntityDeclHandler(XML_Parser parser
,
355 XML_UnparsedEntityDeclHandler handler
);
358 XML_SetNotationDeclHandler(XML_Parser parser
,
359 XML_NotationDeclHandler handler
);
362 XML_SetNamespaceDeclHandler(XML_Parser parser
,
363 XML_StartNamespaceDeclHandler start
,
364 XML_EndNamespaceDeclHandler end
);
367 XML_SetStartNamespaceDeclHandler(XML_Parser parser
,
368 XML_StartNamespaceDeclHandler start
);
371 XML_SetEndNamespaceDeclHandler(XML_Parser parser
,
372 XML_EndNamespaceDeclHandler end
);
375 XML_SetNotStandaloneHandler(XML_Parser parser
,
376 XML_NotStandaloneHandler handler
);
379 XML_SetExternalEntityRefHandler(XML_Parser parser
,
380 XML_ExternalEntityRefHandler handler
);
383 XML_SetExternalEntityRefHandlerArg(XML_Parser parser
,
387 XML_SetSkippedEntityHandler(XML_Parser parser
,
388 XML_SkippedEntityHandler handler
);
391 XML_SetUnknownEncodingHandler(XML_Parser parser
,
392 XML_UnknownEncodingHandler handler
,
393 void *encodingHandlerData
);
396 XML_DefaultCurrent(XML_Parser parser
);
399 XML_SetReturnNSTriplet(XML_Parser parser
, int do_nst
);
402 XML_SetUserData(XML_Parser parser
, void *userData
);
404 #define XML_GetUserData(parser) (*(void **)(parser))
407 XML_SetEncoding(XML_Parser parser
, const XML_Char
*encoding
);
410 XML_UseParserAsHandlerArg(XML_Parser parser
);
413 XML_UseForeignDTD(XML_Parser parser
, XML_Bool useDTD
);
417 XML_SetBase(XML_Parser parser
, const XML_Char
*base
);
420 XML_GetBase(XML_Parser parser
);
423 XML_GetSpecifiedAttributeCount(XML_Parser parser
);
426 XML_GetIdAttributeIndex(XML_Parser parser
);
429 XML_Parse(XML_Parser parser
, const char *s
, int len
, int isFinal
);
432 XML_GetBuffer(XML_Parser parser
, int len
);
435 XML_ParseBuffer(XML_Parser parser
, int len
, int isFinal
);
438 XML_StopParser(XML_Parser parser
, XML_Bool resumable
);
441 XML_ResumeParser(XML_Parser parser
);
451 enum XML_Parsing parsing
;
452 XML_Bool finalBuffer
;
456 XML_GetParsingStatus(XML_Parser parser
, XML_ParsingStatus
*status
);
459 XML_ExternalEntityParserCreate(XML_Parser parser
,
460 const XML_Char
*context
,
461 const XML_Char
*encoding
);
463 enum XML_ParamEntityParsing
{
464 XML_PARAM_ENTITY_PARSING_NEVER
,
465 XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
,
466 XML_PARAM_ENTITY_PARSING_ALWAYS
470 XML_SetParamEntityParsing(XML_Parser parser
,
471 enum XML_ParamEntityParsing parsing
);
474 XML_GetErrorCode(XML_Parser parser
);
476 int XML_GetCurrentLineNumber(XML_Parser parser
);
477 int XML_GetCurrentColumnNumber(XML_Parser parser
);
478 long XML_GetCurrentByteIndex(XML_Parser parser
);
481 XML_GetCurrentByteCount(XML_Parser parser
);
484 XML_GetInputContext(XML_Parser parser
,
488 #define XML_GetErrorLineNumber XML_GetCurrentLineNumber
489 #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
490 #define XML_GetErrorByteIndex XML_GetCurrentByteIndex
493 XML_FreeContentModel(XML_Parser parser
, XML_Content
*model
);
496 XML_MemMalloc(XML_Parser parser
, size_t size
);
499 XML_MemRealloc(XML_Parser parser
, void *ptr
, size_t size
);
502 XML_MemFree(XML_Parser parser
, void *ptr
);
505 XML_ParserFree(XML_Parser parser
);
508 XML_ErrorString(enum XML_Error code
);
511 XML_ExpatVersion(void);
520 XML_ExpatVersionInfo(void);
522 enum XML_FeatureEnum
{
525 XML_FEATURE_UNICODE_WCHAR_T
,
527 XML_FEATURE_CONTEXT_BYTES
,
528 XML_FEATURE_MIN_SIZE
,
529 XML_FEATURE_SIZEOF_XML_CHAR
,
530 XML_FEATURE_SIZEOF_XML_LCHAR
,
532 XML_FEATURE_LARGE_SIZE
536 enum XML_FeatureEnum feature
;
537 const XML_LChar
*name
;
542 XML_GetFeatureList(void);
545 #define XML_MAJOR_VERSION 2
546 #define XML_MINOR_VERSION 0
547 #define XML_MICRO_VERSION 1
550 /****************************************************************************/
556 #elif defined(__VBCC__)
557 #pragma default-align
564 /****************************************************************************/
566 #endif /* EXPAT_EXPAT_H */